@blinkk/root-cms 3.1.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-GXV4UQ6Z.js → chunk-X5CNR4CK.js} +2 -2
  3. package/dist/core/plugin.d.ts +1 -1
  4. package/dist/core/translations.d.ts +19 -4
  5. package/dist/plugin.js +34 -4
  6. package/dist/shared/translation-languages.d.ts +67 -0
  7. package/dist/ui/AIPage-2N5UYBRX.js +1 -0
  8. package/dist/ui/{AssetsPage-5S6PNMF6.js → AssetsPage-KLGNE6D6.js} +1 -1
  9. package/dist/ui/{CollectionPage-CU3VDEXA.js → CollectionPage-D7IG6526.js} +1 -1
  10. package/dist/ui/ComparePage-726NIJW5.js +1 -0
  11. package/dist/ui/{DataPage-XIXFKXDN.js → DataPage-YMSQCIVK.js} +1 -1
  12. package/dist/ui/{DataSourcePage-ORIEQH3Y.js → DataSourcePage-7VPFUG3K.js} +1 -1
  13. package/dist/ui/DocTranslationsPage-FO7O76VK.js +1 -0
  14. package/dist/ui/DocumentPage-M7SJ4ITQ.js +1 -0
  15. package/dist/ui/{EditDataSourcePage-HIGZZQJC.js → EditDataSourcePage-Y7YK6IWT.js} +1 -1
  16. package/dist/ui/{EditReleasePage-KUHBU2HQ.js → EditReleasePage-XZ4RHHRT.js} +1 -1
  17. package/dist/ui/{EmbeddedAIPage-CJWZE5FC.js → EmbeddedAIPage-RJOUIPF2.js} +1 -1
  18. package/dist/ui/EmbeddedDocumentPage-4TLMCDSO.js +1 -0
  19. package/dist/ui/LogsPage-IGDDZGEI.js +1 -0
  20. package/dist/ui/{NewDataSourcePage-7TUUE6ZL.js → NewDataSourcePage-YUPRHL7F.js} +1 -1
  21. package/dist/ui/NewReleasePage-6HHLYOQP.js +1 -0
  22. package/dist/ui/{NotFoundPage-AW6UC6II.js → NotFoundPage-A6OCYREA.js} +1 -1
  23. package/dist/ui/ProjectPage-UHRXNN7O.js +1 -0
  24. package/dist/ui/{ReleasePage-W2R3DIFX.js → ReleasePage-V2JMPWX7.js} +1 -1
  25. package/dist/ui/{ReleasesPage-HBBUGE7D.js → ReleasesPage-SCR4SVKN.js} +1 -1
  26. package/dist/ui/SettingsPage-5XKHPG6K.js +1 -0
  27. package/dist/ui/SidebarToolsPage-VXVRZ2C3.js +1 -0
  28. package/dist/ui/{TaskPage-JYUQEGRB.js → TaskPage-LDPRN3G6.js} +1 -1
  29. package/dist/ui/TasksPage-DIXUWYXM.js +1 -0
  30. package/dist/ui/{TranslationsArbPage-AJLM5VSD.js → TranslationsArbPage-QPD3ZBT4.js} +1 -1
  31. package/dist/ui/TranslationsEditPage-475Z7UPC.js +1 -0
  32. package/dist/ui/{TranslationsPage-HPYAJQ4Q.js → TranslationsPage-674JU6L4.js} +32 -32
  33. package/dist/ui/{chunk-3T4ZWQR4.js → chunk-2EPQJUGM.js} +1 -1
  34. package/dist/ui/{chunk-2KSMCQ6H.js → chunk-2RAVKX2Z.js} +1 -1
  35. package/dist/ui/{chunk-AZCGXQTL.js → chunk-2S5HMST6.js} +1 -1
  36. package/dist/ui/chunk-4ALFT4ES.js +141 -0
  37. package/dist/ui/{chunk-B6M55OFE.js → chunk-4FGASIIX.js} +1 -1
  38. package/dist/ui/chunk-AAHM6RYJ.js +1 -0
  39. package/dist/ui/chunk-AGFPVTBA.js +1 -0
  40. package/dist/ui/chunk-BUNR5EU3.js +1 -0
  41. package/dist/ui/{chunk-O5P3CPJ4.js → chunk-BW2MKGNP.js} +1 -1
  42. package/dist/ui/{chunk-MZTOPPWQ.js → chunk-ENQKSLGJ.js} +1 -1
  43. package/dist/ui/{chunk-76ZGLKLT.js → chunk-GT5EQSEX.js} +1 -1
  44. package/dist/ui/{chunk-OXVYTSIZ.js → chunk-JBHRZ4EX.js} +1 -1
  45. package/dist/ui/{chunk-XT5FNJCX.js → chunk-MSYTAJBV.js} +1 -1
  46. package/dist/ui/{chunk-E76ECIOX.js → chunk-NJMNOITA.js} +1 -1
  47. package/dist/ui/chunk-NWHGT476.js +1 -0
  48. package/dist/ui/{chunk-R6B3W5AJ.js → chunk-PTPYMVFW.js} +1 -1
  49. package/dist/ui/{chunk-TDUBSLEC.js → chunk-Q7IU4QCY.js} +1 -1
  50. package/dist/ui/{chunk-WKF7CSWS.js → chunk-QF3GPZTI.js} +1 -1
  51. package/dist/ui/{chunk-GU24U5RM.js → chunk-RHAJNURN.js} +1 -1
  52. package/dist/ui/{chunk-764W6634.js → chunk-SENZVSVZ.js} +1 -1
  53. package/dist/ui/chunk-SKQECSUR.js +1 -0
  54. package/dist/ui/chunk-TOGLZDK3.js +1 -0
  55. package/dist/ui/{chunk-V4CTOC6E.js → chunk-TPJCPCRR.js} +1 -1
  56. package/dist/ui/{chunk-GQ5IRK43.js → chunk-TVYAZN2Q.js} +1 -1
  57. package/dist/ui/{chunk-WXT7LTQM.js → chunk-VJUMFJIX.js} +1 -1
  58. package/dist/ui/{chunk-U7PWJV6F.js → chunk-W6LP22IK.js} +1 -1
  59. package/dist/ui/chunk-WMICEDOT.js +1 -0
  60. package/dist/ui/{chunk-5AVRMJVW.js → chunk-XMESZUC5.js} +1 -1
  61. package/dist/ui/{chunk-RAXWL656.js → chunk-XWX2622O.js} +1 -1
  62. package/dist/ui/chunk-YMBBWVBB.js +3 -0
  63. package/dist/ui/{chunk-OWQL5DVE.js → chunk-YXSXWFLZ.js} +1 -1
  64. package/dist/ui/chunk-ZMS6NIGG.js +1 -0
  65. package/dist/ui/ui.css +1 -1
  66. package/dist/ui/ui.js +1 -1
  67. package/package.json +3 -3
  68. package/dist/ui/AIPage-EL6DQYII.js +0 -1
  69. package/dist/ui/ComparePage-FTZLYO2O.js +0 -1
  70. package/dist/ui/DocTranslationsPage-4OVBIPSG.js +0 -1
  71. package/dist/ui/DocumentPage-3JPFJF3E.js +0 -1
  72. package/dist/ui/EmbeddedDocumentPage-6XQHYIAO.js +0 -1
  73. package/dist/ui/LogsPage-4DVGYXZY.js +0 -1
  74. package/dist/ui/NewReleasePage-6UT36HDW.js +0 -1
  75. package/dist/ui/ProjectPage-US5FJGFK.js +0 -1
  76. package/dist/ui/SettingsPage-7JQQILUV.js +0 -1
  77. package/dist/ui/SidebarToolsPage-MIYXKHF2.js +0 -1
  78. package/dist/ui/TasksPage-4VFQF243.js +0 -1
  79. package/dist/ui/TranslationsEditPage-RTTGTIGI.js +0 -1
  80. package/dist/ui/chunk-FFHV5S6A.js +0 -1
  81. package/dist/ui/chunk-FSVNOZ6F.js +0 -1
  82. package/dist/ui/chunk-GDXNSFLE.js +0 -1
  83. package/dist/ui/chunk-M3T56ZRP.js +0 -1
  84. package/dist/ui/chunk-MXGHX55S.js +0 -141
  85. package/dist/ui/chunk-QEE7XS6O.js +0 -1
  86. package/dist/ui/chunk-SRX7EWL4.js +0 -1
  87. package/dist/ui/chunk-TFB3VGWP.js +0 -1
  88. package/dist/ui/chunk-YLSRRNSE.js +0 -1
  89. package/dist/ui/chunk-ZN2Y5OUF.js +0 -3
  90. /package/dist/ui/{chunk-MXGHX55S.js.LEGAL.txt → chunk-4ALFT4ES.js.LEGAL.txt} +0 -0
  91. /package/dist/ui/{chunk-E76ECIOX.js.LEGAL.txt → chunk-NJMNOITA.js.LEGAL.txt} +0 -0
@@ -0,0 +1,141 @@
1
+ import{c as lw,e as yw}from"./chunk-WFQU7V3W.js";import{a as au}from"./chunk-XWX2622O.js";import{a as hw,b as gw}from"./chunk-SKQECSUR.js";import{a as uw}from"./chunk-VJUMFJIX.js";import{a as cw,b as dw,c as Gh}from"./chunk-JBHRZ4EX.js";import{a as aa}from"./chunk-3E6CASIN.js";import{a as mw}from"./chunk-FBSBL476.js";import{a as QE,d as ew}from"./chunk-HO3W4RVG.js";import{a as JE}from"./chunk-2EPQJUGM.js";import{c as Wh}from"./chunk-NJMNOITA.js";import{b as XE,d as ZE}from"./chunk-344GZOGG.js";import{a as ow}from"./chunk-XMESZUC5.js";import{a as nw}from"./chunk-ENQKSLGJ.js";import{a as Cr}from"./chunk-MSYTAJBV.js";import{a as lE,d as pw,e as fw,h as bw}from"./chunk-Q7IU4QCY.js";import{g as iw,h as sa,i as sw}from"./chunk-YXSXWFLZ.js";import{c as sE,d as aE,f as Hd}from"./chunk-PTPYMVFW.js";import{a as rw}from"./chunk-FJLNXXE3.js";import{a as _w}from"./chunk-GT5EQSEX.js";import{a as wt,c as ot}from"./chunk-HARRKJFZ.js";import{a as ta,b as na,c as Rd,d as FC}from"./chunk-JS6TK4OP.js";import{c as LC}from"./chunk-JDW4UORS.js";import{a as Rn,b as Yo,d as Rh,e as et,g as iE}from"./chunk-5MV6XVGA.js";import{$ as zd,B as XC,D as ZC,M as QC,N as eE,Q as oa,S as tE,U as nE,V as Bd,W as oE,X as rE,_ as $d,a as Pd,b as Al,c as BC,d as So,e as UC,f as KC,l as jC,v as VC,w as WC,x as Mh}from"./chunk-AGFPVTBA.js";import{b as Fd,e as Lh,f as xr,h as GC,j as YC,k as Ll,l as qC,m as Rl,n as JC}from"./chunk-YMBBWVBB.js";import{a as su,b as tw}from"./chunk-W5DOO6ID.js";import{a as iu}from"./chunk-NSOTG64N.js";import{a as Il,b as br}from"./chunk-J5E457OI.js";import{a as ae,b as Tt,c as Ol}from"./chunk-QHJOTXYB.js";import{a as ns}from"./chunk-BW2MKGNP.js";import{a as Zi,d as RC,e as PC,f as Ld}from"./chunk-KRNQ6L35.js";import{a as No,b as aw}from"./chunk-AAHM6RYJ.js";import{a as Dd,c as Od,e as IC,p as AC,q as Id,s as Ad,u as Md,v as ea}from"./chunk-VD6G5NV4.js";import{d as MC,e as xe}from"./chunk-BUNR5EU3.js";import{$a as pE,$b as LE,A as wC,Ac as Uh,Ba as po,Bb as vE,Bc as jE,Cc as Qd,Da as OC,Dc as VE,Ea as Nd,Ec as WE,Fa as De,Ga as f,Gb as CE,Gc as ko,Hb as Gd,Hc as Kh,Ia as Ph,Ib as EE,Ic as GE,Ja as cE,Jb as wE,Jc as eu,Kb as TE,Kc as tu,Lb as SE,Lc as nu,Ma as li,Mb as kE,Mc as ou,Pb as Fl,Qa as ra,Qb as Yd,Qc as $l,R as TC,Rb as NE,Rc as Xn,Sb as DE,Sc as ru,Ta as Ud,Tb as es,Tc as YE,U as Oh,Ua as Fh,Ub as OE,V as Ft,Va as dE,Vb as IE,W as Ae,Xa as uE,Y as pn,Yb as AE,Yc as jh,Za as Qi,Zb as qd,_ as _r,_a as fo,_b as ME,_c as Vh,a as L,aa as SC,ab as fE,ac as RE,ad as qE,b as bC,bb as hE,bc as Jd,c as F,cb as gE,d as _n,da as Z,db as Kd,dc as PE,e as J,ea as uo,eb as Bh,fa as fn,fc as FE,g as X,ga as kC,gb as jd,h as Ne,i as ft,j as Se,jb as Vd,k as yC,kc as BE,l as xC,la as Qs,lb as Wd,lc as Bl,m as Go,mc as Xd,na as bn,nb as mE,nc as $h,o as wd,oa as Td,oc as zh,p as vC,pa as Sd,pc as $E,q as ii,qa as G,qb as _E,qc as zE,r as CC,ra as Xi,s as EC,sa as NC,sc as HE,tb as ia,tc as UE,u as Dl,ua as Jn,uc as KE,v as nt,va as DC,vb as bE,w as si,wb as vr,x as Nh,xb as yE,xc as ts,y as bt,ya as kd,yb as xE,yc as Hh,z as Dh,za as Ln,zb as Pl,zc as Zd}from"./chunk-LROR6N3B.js";import{b as Ji,d as ke,e as _C,j as pt,k as ri}from"./chunk-KUCVLANF.js";import{h as ai,i as $C,j as zC,k as Ih,l as yr,m as Ah,n as Ml,p as HC}from"./chunk-7SK47HHZ.js";import{b as Sh,c as $e,d as kh,e as qR}from"./chunk-PVAE643M.js";var Xw=Sh(Jw=>{"use strict";var zl=(bt(),qR(Nh));function PP(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var FP=typeof Object.is=="function"?Object.is:PP,BP=zl.useSyncExternalStore,$P=zl.useRef,zP=zl.useEffect,HP=zl.useMemo,UP=zl.useDebugValue;Jw.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=$P(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=HP(function(){function l(h){if(!c){if(c=!0,d=h,h=o(h),r!==void 0&&s.hasValue){var g=s.value;if(r(g,h))return u=g}return u=h}if(g=u,FP(d,h))return g;var m=o(h);return r!==void 0&&r(g,m)?(d=h,g):(d=h,u=m)}var c=!1,d,u,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,o,r]);var a=BP(t,i[0],i[1]);return zP(function(){s.hasValue=!0,s.value=a},[a]),UP(a),a}});var Qw=Sh((Pq,Zw)=>{"use strict";Zw.exports=Xw()});var qv=Sh((oce,fh)=>{"use strict";var vW=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var ie=(function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(_){return _ instanceof i?new i(_.type,m(_.content),_.alias):Array.isArray(_)?_.map(m):_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++n}),m.__id},clone:function m(_,b){b=b||{};var y,v;switch(r.util.type(_)){case"Object":if(v=r.util.objId(_),b[v])return b[v];y={},b[v]=y;for(var x in _)_.hasOwnProperty(x)&&(y[x]=m(_[x],b));return y;case"Array":return v=r.util.objId(_),b[v]?b[v]:(y=[],b[v]=y,_.forEach(function(C,E){y[E]=m(C,b)}),y);default:return _}},getLanguage:function(m){for(;m;){var _=e.exec(m.className);if(_)return _[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,_){m.className=m.className.replace(RegExp(e,"gi"),""),m.classList.add("language-"+_)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(m){var _=document.getElementsByTagName("script");for(var b in _)if(_[b].src==m)return _[b]}return null}},isActive:function(m,_,b){for(var y="no-"+_;m;){var v=m.classList;if(v.contains(_))return!0;if(v.contains(y))return!1;m=m.parentElement}return!!b}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,_){var b=r.util.clone(r.languages[m]);for(var y in _)b[y]=_[y];return b},insertBefore:function(m,_,b,y){y=y||r.languages;var v=y[m],x={};for(var C in v)if(v.hasOwnProperty(C)){if(C==_)for(var E in b)b.hasOwnProperty(E)&&(x[E]=b[E]);b.hasOwnProperty(C)||(x[C]=v[C])}var k=y[m];return y[m]=x,r.languages.DFS(r.languages,function(T,w){w===k&&T!=m&&(this[T]=x)}),x},DFS:function m(_,b,y,v){v=v||{};var x=r.util.objId;for(var C in _)if(_.hasOwnProperty(C)){b.call(_,C,_[C],y||C);var E=_[C],k=r.util.type(E);k==="Object"&&!v[x(E)]?(v[x(E)]=!0,m(E,b,null,v)):k==="Array"&&!v[x(E)]&&(v[x(E)]=!0,m(E,b,C,v))}}},plugins:{},highlightAll:function(m,_){r.highlightAllUnder(document,m,_)},highlightAllUnder:function(m,_,b){var y={callback:b,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),r.hooks.run("before-all-elements-highlight",y);for(var v=0,x;x=y.elements[v++];)r.highlightElement(x,_===!0,y.callback)},highlightElement:function(m,_,b){var y=r.util.getLanguage(m),v=r.languages[y];r.util.setLanguage(m,y);var x=m.parentElement;x&&x.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(x,y);var C=m.textContent,E={element:m,language:y,grammar:v,code:C};function k(w){E.highlightedCode=w,r.hooks.run("before-insert",E),E.element.innerHTML=E.highlightedCode,r.hooks.run("after-highlight",E),r.hooks.run("complete",E),b&&b.call(E.element)}if(r.hooks.run("before-sanity-check",E),x=E.element.parentElement,x&&x.nodeName.toLowerCase()==="pre"&&!x.hasAttribute("tabindex")&&x.setAttribute("tabindex","0"),!E.code){r.hooks.run("complete",E),b&&b.call(E.element);return}if(r.hooks.run("before-highlight",E),!E.grammar){k(r.util.encode(E.code));return}if(_&&t.Worker){var T=new Worker(r.filename);T.onmessage=function(w){k(w.data)},T.postMessage(JSON.stringify({language:E.language,code:E.code,immediateClose:!0}))}else k(r.highlight(E.code,E.grammar,E.language))},highlight:function(m,_,b){var y={code:m,grammar:_,language:b};if(r.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=r.tokenize(y.code,y.grammar),r.hooks.run("after-tokenize",y),i.stringify(r.util.encode(y.tokens),y.language)},tokenize:function(m,_){var b=_.rest;if(b){for(var y in b)_[y]=b[y];delete _.rest}var v=new l;return c(v,v.head,m),a(m,v,_,v.head,0),u(v)},hooks:{all:{},add:function(m,_){var b=r.hooks.all;b[m]=b[m]||[],b[m].push(_)},run:function(m,_){var b=r.hooks.all[m];if(!(!b||!b.length))for(var y=0,v;v=b[y++];)v(_)}},Token:i};t.Prism=r;function i(m,_,b,y){this.type=m,this.content=_,this.alias=b,this.length=(y||"").length|0}i.stringify=function m(_,b){if(typeof _=="string")return _;if(Array.isArray(_)){var y="";return _.forEach(function(k){y+=m(k,b)}),y}var v={type:_.type,content:m(_.content,b),tag:"span",classes:["token",_.type],attributes:{},language:b},x=_.alias;x&&(Array.isArray(x)?Array.prototype.push.apply(v.classes,x):v.classes.push(x)),r.hooks.run("wrap",v);var C="";for(var E in v.attributes)C+=" "+E+'="'+(v.attributes[E]||"").replace(/"/g,"&quot;")+'"';return"<"+v.tag+' class="'+v.classes.join(" ")+'"'+C+">"+v.content+"</"+v.tag+">"};function s(m,_,b,y){m.lastIndex=_;var v=m.exec(b);if(v&&y&&v[1]){var x=v[1].length;v.index+=x,v[0]=v[0].slice(x)}return v}function a(m,_,b,y,v,x){for(var C in b)if(!(!b.hasOwnProperty(C)||!b[C])){var E=b[C];E=Array.isArray(E)?E:[E];for(var k=0;k<E.length;++k){if(x&&x.cause==C+","+k)return;var T=E[k],w=T.inside,S=!!T.lookbehind,N=!!T.greedy,D=T.alias;if(N&&!T.pattern.global){var O=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,O+"g")}for(var A=T.pattern||T,I=y.next,R=v;I!==_.tail&&!(x&&R>=x.reach);R+=I.value.length,I=I.next){var $=I.value;if(_.length>m.length)return;if(!($ instanceof i)){var W=1,P;if(N){if(P=s(A,R,m,S),!P||P.index>=m.length)break;var Et=P.index,q=P.index+P[0].length,ce=R;for(ce+=I.value.length;Et>=ce;)I=I.next,ce+=I.value.length;if(ce-=I.value.length,R=ce,I.value instanceof i)continue;for(var rt=I;rt!==_.tail&&(ce<q||typeof rt.value=="string");rt=rt.next)W++,ce+=rt.value.length;W--,$=m.slice(R,ce),P.index-=R}else if(P=s(A,0,$,S),!P)continue;var Et=P.index,_t=P[0],dt=$.slice(0,Et),ut=$.slice(Et+_t.length),re=R+$.length;x&&re>x.reach&&(x.reach=re);var ee=I.prev;dt&&(ee=c(_,ee,dt),R+=dt.length),d(_,ee,W);var be=new i(C,w?r.tokenize(_t,w):_t,D,_t);if(I=c(_,ee,be),ut&&c(_,I,ut),W>1){var Fe={cause:C+","+k,reach:re};a(m,_,b,I.prev,R,Fe),x&&Fe.reach>x.reach&&(x.reach=Fe.reach)}}}}}}function l(){var m={value:null,prev:null,next:null},_={value:null,prev:m,next:null};m.next=_,this.head=m,this.tail=_,this.length=0}function c(m,_,b){var y=_.next,v={value:b,prev:_,next:y};return _.next=v,y.prev=v,m.length++,v}function d(m,_,b){for(var y=_.next,v=0;v<b&&y!==m.tail;v++)y=y.next;_.next=y,y.prev=_,m.length-=v}function u(m){for(var _=[],b=m.head.next;b!==m.tail;)_.push(b.value),b=b.next;return _}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var _=JSON.parse(m.data),b=_.language,y=_.code,v=_.immediateClose;t.postMessage(r.highlight(y,r.languages[b],b)),v&&t.close()},!1)),r;var p=r.util.currentScript();p&&(r.filename=p.src,p.hasAttribute("data-manual")&&(r.manual=!0));function h(){r.manual||r.highlightAll()}if(!r.manual){var g=document.readyState;g==="loading"||g==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return r})(vW);typeof fh<"u"&&fh.exports&&(fh.exports=ie);typeof global<"u"&&(global.Prism=ie);ie.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};ie.languages.markup.tag.inside["attr-value"].inside.entity=ie.languages.markup.entity;ie.languages.markup.doctype.inside["internal-subset"].inside=ie.languages.markup;ie.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))});Object.defineProperty(ie.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:ie.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:ie.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},ie.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(ie.languages.markup.tag,"addAttribute",{value:function(t,e){ie.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:ie.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});ie.languages.html=ie.languages.markup;ie.languages.mathml=ie.languages.markup;ie.languages.svg=ie.languages.markup;ie.languages.xml=ie.languages.extend("markup",{});ie.languages.ssml=ie.languages.xml;ie.languages.atom=ie.languages.xml;ie.languages.rss=ie.languages.xml;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(ie);ie.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};ie.languages.javascript=ie.languages.extend("clike",{"class-name":[ie.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});ie.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;ie.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:ie.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:ie.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:ie.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:ie.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:ie.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});ie.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:ie.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});ie.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});ie.languages.markup&&(ie.languages.markup.tag.addInlined("script","javascript"),ie.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));ie.languages.js=ie.languages.javascript;(function(){if(typeof ie>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",e=function(p,h){return"\u2716 Error "+p+" while fetching file: "+h},n="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",i="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+i+'"])';function c(p,h,g){var m=new XMLHttpRequest;m.open("GET",p,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?h(m.responseText):m.status>=400?g(e(m.status,m.statusText)):g(n))},m.send(null)}function d(p){var h=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(h){var g=Number(h[1]),m=h[2],_=h[3];return m?_?[g,Number(_)]:[g,void 0]:[g,g]}}ie.hooks.add("before-highlightall",function(p){p.selector+=", "+l}),ie.hooks.add("before-sanity-check",function(p){var h=p.element;if(h.matches(l)){p.code="",h.setAttribute(r,i);var g=h.appendChild(document.createElement("CODE"));g.textContent=t;var m=h.getAttribute("data-src"),_=p.language;if(_==="none"){var b=(/\.(\w+)$/.exec(m)||[,"none"])[1];_=o[b]||b}ie.util.setLanguage(g,_),ie.util.setLanguage(h,_);var y=ie.plugins.autoloader;y&&y.loadLanguages(_),c(m,function(v){h.setAttribute(r,s);var x=d(h.getAttribute("data-range"));if(x){var C=v.split(/\r\n?|\n/g),E=x[0],k=x[1]==null?C.length:x[1];E<0&&(E+=C.length),E=Math.max(0,Math.min(E-1,C.length)),k<0&&(k+=C.length),k=Math.max(0,Math.min(k,C.length)),v=C.slice(E,k).join(`
2
+ `),h.hasAttribute("data-start")||h.setAttribute("data-start",String(E+1))}g.textContent=v,ie.highlightElement(g)},function(v){h.setAttribute(r,a),g.textContent=v})}}),ie.plugins.fileHighlight={highlight:function(h){for(var g=(h||document).querySelectorAll(l),m=0,_;_=g[m++];)ie.highlightElement(_)}};var u=!1;ie.fileHighlight=function(){u||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),u=!0),ie.plugins.fileHighlight.highlight.apply(this,arguments)}})()});Se();Se();Se();function lu(t){return f(ts,{className:t.className,size:t.size})}function Ew(t){let[e,n]=L(null),[o,r]=L("");if(F(()=>{let a=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let c=await l.json();a&&n(c)}).catch(l=>{a&&r(String(l))}),()=>{a=!1}},[]),!e&&!o)return f("div",{className:"AiEditModal__ChatPanel__loading",children:f(Ft,{size:"sm",color:"gray"})});if(!(!!e?.enabled&&(e.models?.length||0)>0))return f("div",{className:"AiEditModal__ChatPanel__notConfigured",children:[f("div",{className:"AiEditModal__ChatPanel__notConfigured__icon",children:f(ts,{size:32})}),f("div",{className:"AiEditModal__ChatPanel__notConfigured__title",children:"Root AI is not configured for this project."}),f("div",{className:"AiEditModal__ChatPanel__notConfigured__body",children:["Add an ",f("code",{children:"ai.models"})," entry to ",f("code",{children:"cmsPlugin()"})," in"," ",f("code",{children:"root.config.ts"}),"."]}),o&&f("pre",{className:"AiEditModal__ChatPanel__notConfigured__error",children:o})]});let s=e.models.find(a=>a.id===e.defaultModel)||e.models[0];return f(JR,{model:s,editModeData:t.editModeData,onEditModeResponse:t.onEditModeResponse,welcome:t.children})}function JR(t){let e=J(t.editModeData);e.current=t.editModeData;let n=X(()=>new XE({api:"/cms/api/ai.edit_object",credentials:"include",prepareSendMessagesRequest:({messages:p})=>({body:{messages:p,modelId:t.model.id,editData:e.current}})}),[t.model.id]),o=J(t.onEditModeResponse);o.current=t.onEditModeResponse;let r=J(new Map),{messages:i,sendMessage:s,status:a,error:l,stop:c,addToolOutput:d}=QE({transport:n,sendAutomaticallyWhen:ZE,onToolCall:async({toolCall:p})=>{let h=await ew(p.toolName,p.input);d({tool:p.toolName,toolCallId:p.toolCallId,output:h})}}),u=a==="streaming"||a==="submitted";return F(()=>{let p=o.current;if(p)for(let h=i.length-1;h>=0;h--){let g=i[h];if(g.role!=="assistant")continue;let m=cP(g),_=dP(m);if(!_||r.current.get(g.id)===_)return;try{let y=JSON.parse(_);y&&typeof y=="object"&&(r.current.set(g.id,_),p({message:"",data:y}))}catch{}return}},[i]),f(ke,{children:[f(XR,{messages:i,isStreaming:u,welcome:t.welcome}),l&&f("div",{className:"AiEditModal__ChatPanel__error",children:[f("strong",{children:"Error:"})," ",l.message]}),f(oP,{canAttach:t.model.capabilities.attachments,isStreaming:u,onStop:c,onSend:(p,h)=>{if(!p&&h.length===0)return;let g=rP(h),m=[p,g.text].filter(Boolean).join(`
3
+
4
+ `);s({text:m,files:g.files.map(_=>({type:"file",mediaType:_.mediaType,url:_.url,filename:_.filename}))})}})]})}function XR(t){let e=J(null);return F(()=>{let n=e.current;n&&(n.scrollTop=n.scrollHeight)},[t.messages]),t.messages.length===0?f("div",{className:"AiEditModal__ChatPanel__transcript AiEditModal__ChatPanel__transcript--empty",ref:e,children:f("div",{className:"AiEditModal__ChatPanel__welcome",children:[f("div",{className:"AiEditModal__ChatPanel__welcome__icon",children:f(lu,{})}),f("div",{className:"AiEditModal__ChatPanel__welcome__title",children:"Edit with Root AI"}),t.welcome&&f("div",{className:"AiEditModal__ChatPanel__welcome__body",children:t.welcome})]})}):f("div",{className:"AiEditModal__ChatPanel__transcript",ref:e,children:f("div",{className:"AiEditModal__ChatPanel__transcript__inner",children:[t.messages.map(n=>f(ZR,{message:n},n.id)),t.isStreaming&&f("div",{className:"AiEditModal__ChatPanel__streamingIndicator",children:[f(Ft,{size:"xs",color:"gray"}),f("span",{children:"Thinking\u2026"})]})]})})}function ZR(t){let e=t.message,n=e.role==="user",o=n?"You":"Root AI",r=n?window.firebase.user?.photoURL:null;return f("div",{className:xe("AiEditModal__ChatPanel__message",`AiEditModal__ChatPanel__message--${e.role}`),children:[f("div",{className:"AiEditModal__ChatPanel__message__avatar",children:r?f("img",{src:r,alt:o}):f(ts,{size:18})}),f("div",{className:"AiEditModal__ChatPanel__message__body",children:[f("div",{className:"AiEditModal__ChatPanel__message__username",children:o}),f("div",{className:"AiEditModal__ChatPanel__message__parts",children:(e.parts||[]).map((i,s)=>f(QR,{part:i},s))})]})]})}function QR(t){let e=t.part;if(e.type==="text"){if(!e.text)return null;let n=uP(e.text);return n?f("div",{className:"AiEditModal__ChatPanel__textPart",children:f(Wh,{code:n})}):null}return e.type==="reasoning"?f(eP,{text:e.text}):e.type==="file"?f(tP,{part:e}):typeof e.type=="string"&&e.type.startsWith("tool-")?f(xw,{part:e}):e.type==="dynamic-tool"?f(xw,{part:e}):(e.type==="step-start",null)}function eP(t){let[e,n]=L(!1);return t.text?f("div",{className:xe("AiEditModal__ChatPanel__reasoning",e&&"AiEditModal__ChatPanel__reasoning--open"),children:[f("button",{type:"button",className:"AiEditModal__ChatPanel__reasoning__toggle",onClick:()=>n(!e),children:[f(fo,{size:14,style:{transform:e?"rotate(0deg)":"rotate(-90deg)"}}),f("span",{children:"Thinking"})]}),e&&f("div",{className:"AiEditModal__ChatPanel__reasoning__body",children:f(Wh,{code:t.text})})]}):null}function tP(t){let e=t.part;return e.mediaType?.startsWith("image/")?f("div",{className:"AiEditModal__ChatPanel__filePart",children:f("img",{src:e.url,alt:e.filename||"attachment"})}):f("a",{className:"AiEditModal__ChatPanel__filePart AiEditModal__ChatPanel__filePart--link",href:e.url,target:"_blank",children:[f(Bl,{size:14}),f("span",{children:e.filename||e.url})]})}function xw(t){let e=t.part,n=typeof e.type=="string"&&e.type.startsWith("tool-")?e.type.slice(5):e.toolName||"tool",o=e.state||"",[r,i]=L(!1);return f("div",{className:"AiEditModal__ChatPanel__tool",children:[f("button",{type:"button",className:"AiEditModal__ChatPanel__tool__header",onClick:()=>i(!r),children:[f($l,{size:14}),f("code",{children:n}),f("span",{className:"AiEditModal__ChatPanel__tool__state",children:nP(o)}),f(fo,{size:14,style:{marginLeft:"auto",transform:r?"rotate(0deg)":"rotate(-90deg)"}})]}),r&&f("div",{className:"AiEditModal__ChatPanel__tool__body",children:[e.input&&f("details",{open:!0,children:[f("summary",{children:"Input"}),f("pre",{children:JSON.stringify(e.input,null,2)})]}),e.output&&f("details",{open:!0,children:[f("summary",{children:"Output"}),f("pre",{children:JSON.stringify(e.output,null,2)})]}),e.errorText&&f("div",{className:"AiEditModal__ChatPanel__tool__error",children:e.errorText})]})]})}function nP(t){switch(t){case"input-streaming":return"preparing\u2026";case"input-available":return"running\u2026";case"output-available":return"done";case"output-error":return"error";default:return t}}function oP(t){let[e,n]=L(""),[o,r]=L([]),[i,s]=L(!1),a=J(null),l=J(null);F(()=>{window.requestAnimationFrame(()=>{let g=l.current;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,200)}px`)})},[e,o]);let d=Ne(()=>{t.isStreaming||!e&&o.length===0||(t.onSend(e,o),n(""),r([]),a.current&&(a.current.value=""))},[e,o,t.isStreaming]),u=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),d())},p=async g=>{s(!0);try{let m=g.type||lP(g.name),_=await sP(g,m),b=await ai(g,{disableGci:!0});r(y=>[...y,{url:b.src,filename:b.filename||g.name,mediaType:m,textContent:_?.text,textTruncated:_?.truncated,width:b.width,height:b.height}])}catch(m){console.error("upload failed",m)}finally{s(!1),a.current&&(a.current.value="")}},h=g=>{let m=g.target;Array.from(m.files||[]).forEach(p)};return f("div",{className:"AiEditModal__ChatPanel__composer",children:[f("div",{className:xe("AiEditModal__ChatPanel__composer__prompt",(i||o.length>0)&&"AiEditModal__ChatPanel__composer__prompt--hasImage"),children:[t.canAttach&&f("label",{className:"AiEditModal__ChatPanel__composer__imageUpload",children:[f("input",{ref:a,type:"file",className:"AiEditModal__ChatPanel__composer__imageUpload__input",onChange:h}),f(De,{label:"Upload file",children:f(Ae,{component:"div",className:"AiEditModal__ChatPanel__composer__imageUpload__icon",radius:"xl",children:f(Bl,{size:18})})})]}),f("textarea",{ref:l,className:"AiEditModal__ChatPanel__composer__textInput",placeholder:"Tell me what you want to change...",value:e,rows:1,autofocus:!0,onKeyDown:u,onChange:g=>n(g.target.value),onPaste:g=>{let m=g.clipboardData?.items||[];for(let _ of m)if(_.kind==="file"){let b=_.getAsFile();b&&t.canAttach&&p(b)}}}),(i||o.length>0)&&f("div",{className:"AiEditModal__ChatPanel__composer__attachments",children:[i&&f(Ft,{size:"sm"}),o.map((g,m)=>f(De,{label:g.filename,transition:"pop",position:"top",withArrow:!0,children:f("button",{className:"AiEditModal__ChatPanel__composer__attachment",onClick:()=>r(_=>_.filter((b,y)=>y!==m)),children:[g.mediaType.startsWith("image/")?f("img",{src:g.url,alt:g.filename}):f("span",{className:"AiEditModal__ChatPanel__composer__attachment__name",children:g.filename}),f("div",{className:"AiEditModal__ChatPanel__composer__attachment__close",children:f(jh,{size:20,color:"white"})})]})},m))]}),t.isStreaming?f(Ae,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",onClick:t.onStop,title:"Stop",children:f(jh,{size:18})}):f(Ae,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",disabled:i||!e&&o.length===0,onClick:d,title:"Send",children:f(VE,{size:18})})]}),f("div",{className:"AiEditModal__ChatPanel__composer__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var vw=1e5;function rP(t){let e=t.filter(Cw),n=t.filter(o=>!Cw(o)).map(iP);return{files:e,text:n.length?`Attached files:
5
+
6
+ ${n.join(`
7
+
8
+ `)}`:""}}function Cw(t){return t.mediaType.startsWith("image/")}function iP(t){let e=`File: ${t.filename} (${t.mediaType})`;if(t.textContent!==void 0){let n=t.textTruncated?`
9
+
10
+ [Content truncated before sending to the model.]`:"";return`${e}
11
+ URL: ${t.url}
12
+
13
+ ~~~
14
+ ${t.textContent}${n}
15
+ ~~~`}return`${e}
16
+ URL: ${t.url}
17
+
18
+ [The file was uploaded, but its binary content was not inlined into this chat message.]`}async function sP(t,e){if(!aP(t.name,e))return null;let n=await t.text();return n.length<=vw?{text:n,truncated:!1}:{text:n.slice(0,vw),truncated:!0}}function aP(t,e){return e.startsWith("text/")?!0:[".css",".js",".jsx",".json",".md",".mdx",".mjs",".scss",".ts",".tsx",".txt",".yaml",".yml"].some(n=>t.toLowerCase().endsWith(n))}function lP(t){let e=t.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".webp")?"image/webp":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".svg")?"image/svg+xml":e.endsWith(".pdf")?"application/pdf":e.endsWith(".json")?"application/json":e.endsWith(".csv")?"text/csv":e.endsWith(".md")?"text/markdown":e.endsWith(".txt")?"text/plain":"application/octet-stream"}function cP(t){return(t.parts||[]).filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join("")}function dP(t){if(!t)return null;let e=/```(?:json)?\s*\n([\s\S]*?)```/gi,n,o=null;for(;(n=e.exec(t))!==null;)o=n[1].trim();return o}function uP(t){if(!t)return t;let e=/```(?:json)?\s*\n[\s\S]*?```/gi,n=Array.from(t.matchAll(e)),o=t;if(n.length>0){let i=n[n.length-1],s=i.index??-1,a=s+i[0].length;s!==-1&&/^\s*$/.test(o.slice(a))&&(o=o.slice(0,s))}if((o.match(/```/g)||[]).length%2===1){let i=o.lastIndexOf("```");i!==-1&&(o=o.slice(0,i))}return o.trim()}var Yh="AiEditModal";function ww(){let t=wt(),e=ot();return{open:n=>{t.openContextModal(Yh,{...e,title:n.title||"Edit with AI (Experimental)",innerProps:n,size:"calc(min(1920px, calc(100% - 96px)))",centered:!0})},close:()=>{t.closeModal(Yh)}}}function pP(t){let{innerProps:e,context:n,id:o}=t,r=J(null),i=X(()=>JSON.stringify(e.data||{},null,2),[e.data]),[s,a]=L(i),l=X(()=>{if(!s)return null;try{return JSON.parse(s)}catch{return null}},[s]),c=X(()=>s!==i,[s,i]),d=Ne(()=>{if(!l)return;let p=zd(l);e.onSave&&e.onSave(p)},[l]),u=Ne(p=>{if(p?.data){let h=JSON.stringify(p.data,null,2);a(h),r.current?.click()}},[]);return f("div",{className:"AiEditModal",children:[f("div",{className:"AiEditModal__SplitPanel",children:[f("div",{className:"AiEditModal__SplitPanel__ChatPanel",children:f(Ew,{editModeData:l,onEditModeResponse:u,children:[f("p",{children:"Tell me what you want to change. I can make simple text edits, replace content within a module, or answer questions about the content."}),f("p",{children:"Just enter simple instructions, or attach a screenshot and ask me to use it as reference."})]})}),f("div",{className:"AiEditModal__SplitPanel__JsonPanel",children:f(Nd,{className:"AiEditModal__Tabs",grow:!0,children:[f(Nd.Tab,{label:"JSON",icon:f(NE,{size:20}),children:f("div",{className:"AiEditModal__JsonEditor",children:f(Td,{value:s,onChange:p=>a(p),formatOnBlur:!0,height:"100%",className:"AiEditModal__JsonInput"})})}),f(Nd.Tab,{ref:r,label:"Diff",icon:f(yE,{size:20}),children:f("div",{className:"AiEditModal__JsonDiffViewer",children:e.data&&s&&f(JE,{oldCode:i,newCode:s})})})]})})]}),f("div",{className:"AiEditModal__buttons",children:[f(Z,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),f(Z,{variant:"default",size:"xs",type:"button",leftIcon:f(li,{size:16}),disabled:!c,onClick:()=>a(i),children:"Reset"}),f(Z,{leftIcon:f(Qi,{size:16}),variant:"filled",size:"xs",color:"green",disabled:!l||!c,onClick:d,children:"Accept changes"})]})]})}pP.id=Yh;var qh="AssetPickerModal";function Tw(){let t=null;try{t=wt()}catch{t=null}let e=ot();return{enabled:t!==null,open:n=>{if(!t){console.warn("useAssetPickerModal() requires a <ModalsProvider> context.");return}t.openContextModal(qh,{...e,title:"Select from asset library",innerProps:n,size:"800px",overflow:"inside"})},close:()=>{t?.closeModal(qh)}}}function fP(t){let{innerProps:e,context:n,id:o}=t;function r(i){e.onSelect&&e.onSelect(i),n.closeModal(o)}return f("div",{className:"AssetPickerModal",children:f(ow,{mode:"pick",accept:e.accept,initialFolder:e.initialFolder,onFolderChange:KC,onPickFile:r})})}fP.id=qh;Se();var Jh="ComponentPickerModal",hP="root::ComponentPickerModal:layout",gP=3;function Sw(){let t=wt(),e=ot();return{open:n=>{t.openContextModal(Jh,{...e,innerProps:n,size:"720px",overflow:"inside",title:"Select a component"})},close:()=>{t.closeModal(Jh)}}}function Xh(t){let{innerProps:e}=t,[n,o]=L(""),[r,i]=rw(hP,"list"),[s,a]=L(0),l=J(null),c=X(()=>{let h=n.trim().toLowerCase();return h?e.options.filter(g=>[g.schema.name,g.schema.label,g.schema.description,g.preset?.id,g.preset?.label,g.preset?.description].filter(Boolean).join(" ").toLowerCase().includes(h)):e.options},[e.options,n]);F(()=>{a(c.length>0?0:-1)},[c]),F(()=>{if(s<0||!l.current)return;l.current.querySelectorAll(".ComponentPickerModal__Card")[s]?.scrollIntoView({block:"nearest"})},[s]);function d(h){if(c.length===0)return;let g=r==="grid"?gP:1,m=c.length-1;if(h.key==="ArrowDown")h.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+g));else if(h.key==="ArrowUp")h.preventDefault(),a(_=>Math.max(0,_-g));else if(h.key==="ArrowRight"&&r==="grid")h.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+1));else if(h.key==="ArrowLeft"&&r==="grid")h.preventDefault(),a(_=>Math.max(0,_-1));else if(h.key==="Enter"&&s>=0){let _=c[s];_&&(h.preventDefault(),e.onSelect(_))}}let u=!!e.onRemove&&!n.trim();return f("div",{className:`ComponentPickerModal ${r==="grid"?"ComponentPickerModal--grid":"ComponentPickerModal--list"}`,onKeyDown:d,children:[f("div",{className:"ComponentPickerModal__controls",children:[f(Jn,{"data-autofocus":!0,placeholder:e.searchPlaceholder||"Search components...",value:n,onChange:h=>o(h.target.value),icon:f(Qd,{size:16}),size:"xs",className:"ComponentPickerModal__controls__search"}),f(kd,{className:"ComponentPickerModal__controls__layout",size:"xs",value:r,onChange:h=>i(h),data:[{value:"list",label:f("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"List layout",title:"List layout",children:f(IE,{size:14})})},{value:"grid",label:f("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"Grid layout",title:"Grid layout",children:f(OE,{size:14})})}]})]}),c.length===0?f("div",{className:"ComponentPickerModal__empty",children:e.options.length===0?"No component types available.":"No components match your search."}):f("div",{className:"ComponentPickerModal__cards",ref:l,children:c.map((h,g)=>f(Xh.Card,{option:h,layout:r,focused:g===s,onMouseEnter:()=>a(g),onSelect:()=>e.onSelect(h)},h.key))}),u&&f("div",{className:"ComponentPickerModal__footer",children:f(Z,{variant:"subtle",color:"red",size:"xs",leftIcon:f(Xn,{size:14}),onClick:()=>e.onRemove?.(),children:"Clear selection"})})]})}Xh.Card=t=>{let{schema:e,preset:n}=t.option,o=n?.label||n?.id||e.label||e.name,r=n?.description??e.description??"",i=n?.image||e.image,s=n?e.label||e.name:"",l=t.layout==="grid"?180:120,c=t.layout==="grid"?120:90,d=["ComponentPickerModal__Card",t.focused?"ComponentPickerModal__Card--focused":""].filter(Boolean).join(" ");return f("button",{type:"button",className:d,onClick:t.onSelect,onMouseEnter:t.onMouseEnter,children:[f("div",{className:"ComponentPickerModal__Card__image",children:f(Qs,{src:i,width:l,height:c,withPlaceholder:!i,alt:o})}),f("div",{className:"ComponentPickerModal__Card__content",children:[s&&f("div",{className:"ComponentPickerModal__Card__content__subtitle",children:s}),f("div",{className:"ComponentPickerModal__Card__content__title",children:o}),r&&f("div",{className:"ComponentPickerModal__Card__content__description",children:r})]})]})};Xh.id=Jh;Se();var Zh="EditJsonModal";function Qh(){let t=wt(),e=ot();return{open:n=>{t.openContextModal(Zh,{...e,title:n.title||"Edit JSON",innerProps:n,size:"680px",centered:!0})},close:()=>{t.closeModal(Zh)}}}function mP(t){let{innerProps:e,context:n,id:o}=t,r=JSON.stringify(e.data||{},null,2),[i,s]=L(r),[a,l]=L(!0),[c,d]=L(!1),[u,p]=L(!1);function h(_){s(_),d(!1);try{JSON.parse(_),l(!0)}catch{l(!1)}p(_!==r)}function g(){navigator.clipboard.writeText(i).then(()=>d(!0))}function m(){let _=JSON.parse(i),b=zd(_);e.onSave&&e.onSave(b)}return f("div",{className:"EditJsonModal",children:[f(Td,{value:i,onChange:h,formatOnBlur:!0,autosize:!0,minRows:4,maxRows:25}),f("div",{className:"EditJsonModal__buttons",children:[f(Z,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),f(Z,{leftIcon:f(jd,{size:16}),variant:"filled",size:"xs",color:"dark",disabled:!a,type:"button",onClick:g,children:c?"Copied!":"Copy"}),f(Z,{variant:"default",size:"xs",type:"button",leftIcon:f(li,{size:16}),disabled:!u,onClick:()=>{s(r),l(!0),p(!1)},children:"Reset"}),f(Z,{leftIcon:f(_E,{size:16}),variant:"filled",size:"xs",color:"blue",disabled:!a||!u,onClick:m,children:"Save"})]})]})}mP.id=Zh;Se();Se();function Nw(t){let{docId:e,deepKey:n,translatable:o}=t,[r,i]=L(!0),[s,a]=L([]),l=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return F(()=>{async function c(){i(!0);let[d,u]=await Promise.all([tE(e),nE(e,"draft")]),p=d.versions,h=[];if(u){let m=Yo(u,n);h.push({value:kw(m),modifiedBy:u.sys?.modifiedBy||"Unknown",modifiedAt:u.sys?.modifiedAt?.toDate?.()||new Date,versionId:"draft"})}for(let m of p){let _=Yo(m,n);h.push({value:kw(_),modifiedBy:m.sys?.modifiedBy||"Unknown",modifiedAt:m.sys?.modifiedAt?.toDate?.()||new Date,versionId:m._versionId})}let g=[];for(let m of h){let _=g[g.length-1];(!_||_.value!==m.value)&&g.push(m)}a(g),i(!1)}c()},[e,n]),r?f("div",{className:"FieldHistory__loading",children:f(Ft,{size:"sm"})}):s.length===0?f("div",{className:"FieldHistory__empty",children:"No history available."}):f("div",{className:"FieldHistory",children:s.map((c,d)=>f("div",{className:"FieldHistory__entry",children:[f("div",{className:"FieldHistory__entry__header",children:[f("span",{className:"FieldHistory__entry__author",children:c.modifiedBy}),f("span",{className:"FieldHistory__entry__date",children:l.format(c.modifiedAt)}),d===0&&f("span",{className:"FieldHistory__entry__badge",children:"Current"}),o&&c.value&&f("span",{className:"FieldHistory__entry__translationsLink",children:f(_P,{value:c.value})})]}),f("div",{className:"FieldHistory__entry__value",children:c.value||f("span",{className:"FieldHistory__entry__empty",children:"(empty)"})})]},c.versionId))})}function _P(t){let[e,n]=L("");return F(()=>{xr(t.value).then(o=>{n(`/cms/translations/${o}`)})},[t.value]),e?f(De,{label:"Open in Translations Editor",withArrow:!0,position:"right",children:f(Ae,{component:"a",href:e,target:"_blank",variant:"transparent",size:"sm",children:f(es,{size:16})})}):null}function kw(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}var eg="EditTranslationsModal";function Ow(){let t=wt(),e=ot();return{open:n=>{t.openContextModal(eg,{...e,innerProps:n,size:"900px",title:"Edit translations",overflow:"inside",className:"EditTranslationsModalWrap"})},close:()=>{t.closeModal(eg)}}}function tg(t){let{innerProps:e,context:n,id:o}=t,r=e.strings||[],i=window.__ROOT_CTX.rootConfig.i18n||{},s=Ll(i.locales||["en"]),[a,l]=L({}),[c,d]=L([]),[u,p]=L(!1),[h,g]=L(!1),[m,_]=L(!0),[b,y]=L(!1),[v,x]=L(""),[C,E]=L(!1),[k,T]=L("translations"),w=e.draft||null;F(()=>{if(e.field?.deepKey&&w?.controller){let A=Dw(e.field.deepKey),I=w.controller.getValue(A)||{};y(I.translate===!1),x(I.description||"")}},[e.field?.deepKey,w?.controller]),F(()=>{Fd({tags:[e.docId]}).then(A=>{let I={};Object.values(A).forEach(R=>{let $={source:R.source};s.forEach(W=>{let P=Rl(R,W);P&&($[W]=P)}),I[R.source]=$}),l(I),_(!1)})},[e.docId]);async function S(){g(!0),await br(async()=>{let A=`edit-translations-${e.docId}`;if(ae({id:A,loading:!0,title:"Saving translations",message:`Updating for ${e.docId}...`,autoClose:!1,disallowClose:!0}),e.field?.deepKey&&w?.controller){let I=Dw(e.field.deepKey),R=w.controller.getValue(I)||{};b?R.translate=!1:delete R.translate,v?R.description=v:delete R.description,Object.keys(R).length>0?await w.controller.updateKey(I,R):await w.controller.removeKey(I),await w.controller.flush()}if(!b&&c.length>0){let I=[];c.forEach(R=>{let $=a[R];I.push($)}),await oa(e.docId,I)}Tt({id:A,title:"Saved translations",message:`Updated translations for ${e.docId}!`,autoClose:!1})}),g(!1)}function N(A){l(I=>{let R={...I};return R[A.source]=A,R}),d(I=>{let R=new Set(I);return R.add(A.source),Array.from(R)}),p(!0)}async function D(){if(r.length!==0){E(!0);try{await br(async()=>{for(let A of r){let I=a[A]||{source:A},R={};s.forEach(q=>{I[q]&&(R[q]=I[q])});let $=s.filter(q=>!I[q]);if($.length===0)continue;let W=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:A,targetLocales:$,description:v||void 0,existingTranslations:R})});if(W.status!==200){let q=await W.text();throw new Error(`Translation failed: ${q}`)}let P=await W.json();if(P.success&&P.translations){let q={...I};Object.entries(P.translations).forEach(([ce,rt])=>{q[ce]=rt}),N(q)}}ae({message:"Finished generating AI translations",color:"green"})})}finally{E(!1)}}}function O(){if(!No())return!1;for(let A of r){let I=a[A]||{};for(let R of s)if(!I[R])return!0}return!1}return f("div",{className:"EditTranslationsModal",children:[m?f(Ft,{}):f(ke,{children:[e.field?.deepKey&&f("div",{className:"EditTranslationsModal__tabs",children:[f("button",{type:"button",className:xe("EditTranslationsModal__tabs__tab",k==="translations"&&"active"),onClick:()=>T("translations"),children:"Translations"}),f("button",{type:"button",className:xe("EditTranslationsModal__tabs__tab",k==="history"&&"active"),onClick:()=>T("history"),children:"History"})]}),k==="history"&&e.field?.deepKey?f(Nw,{docId:e.docId,deepKey:e.field.deepKey,translatable:!0}):f(ke,{children:[f("div",{className:"EditTranslationsModal__controls",children:[f("div",{className:"EditTranslationsModal__controls__doNotTranslate",children:[f(uo,{label:"Do not translate",checked:b,onChange:A=>{y(A.currentTarget.checked),p(!0)},size:"sm"}),f(De,{label:"Prevent the string from being included for translation",withArrow:!0,position:"right",children:f(Fl,{size:14,style:{marginLeft:"6px"}})})]}),f("div",{className:"EditTranslationsModal__controls__description",children:[f("div",{className:"EditTranslationsModal__controls__description__label",children:[f("span",{children:"Description"}),f(De,{label:"Translator notes may be included when the string is extracted and sent for translation",withArrow:!0,position:"right",children:f(Fl,{size:14,style:{marginLeft:"6px"}})})]}),f(bn,{size:"sm",autosize:!0,minRows:1,maxRows:6,value:v,placeholder:"Add context or notes for translators...",onChange:A=>{x(A.currentTarget.value),p(!0)}})]})]}),f("table",{className:"EditTranslationsModal__table",children:[f("thead",{style:{display:b?"none":"table-header-group"},children:f("tr",{children:[f("th",{children:f(Cr,{size:"h4",weight:"semi-bold",children:"SOURCE"})}),f("th",{children:f("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[f(Cr,{size:"h4",weight:"semi-bold",children:"TRANSLATIONS"}),O()&&f(De,{label:"Generate quick translations using AI",withArrow:!0,position:"left",children:f(Ae,{variant:"outline",onClick:D,loading:C,disabled:C,sx:{height:30,width:30,borderColor:"#ced4da"},children:C?f(Jd,{size:16}):f(ko,{size:16,fill:"currentColor",stroke:1.5})})})]})})]})}),f("tbody",{children:r.map(A=>f("tr",{style:{display:b?"none":"table-row"},children:[f("td",{children:f("div",{className:"EditTranslationsModal__table__source",children:A})}),f("td",{children:f(tg.StringsEditor,{source:A,locales:s,translations:a[A]||{},onChange:N})})]}))})]})]})]}),f("div",{className:"EditTranslationsModal__footer",children:[f("div",{className:"EditTranslationsModal__footer__left",children:[f(Z,{component:"a",href:`/cms/translations/${e.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:f(vr,{size:14}),children:"Open Translations Editor"}),e.l10nSheet&&f("div",{className:"EditTranslationsModal__footer__gsheet",children:[f("strong",{children:"NOTE:"})," Translations for this doc are managed in"," ",f("a",{href:na(e.l10nSheet),target:"_blank",rel:"noopener noreferrer",children:"Google Sheets"})]})]}),f("div",{className:"EditTranslationsModal__footer__buttons",children:[f(Z,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),f(Z,{variant:"filled",size:"xs",color:"dark",onClick:()=>S(),disabled:!u,loading:h,children:"Save"})]})]})]})}tg.StringsEditor=t=>{let e=t.locales,[n,o]=L(t.translations||{}),[r,i]=L(!1);F(()=>{o(t.translations||{})},[t.translations]);function s(a,l){i(!0),o(c=>{let d={...c,source:t.source};return d[a]=l,d})}return F(()=>{r&&t.onChange(n)},[r,n]),f("div",{className:"EditTranslationsModal__StringsEditor",children:e.map(a=>f("div",{className:"EditTranslationsModal__StringsEditor__row",children:[f("div",{className:"EditTranslationsModal__StringsEditor__row__locale",children:a}),f("div",{className:xe("EditTranslationsModal__StringsEditor__row__translation",n[a]?"hasValue":"empty"),children:f(bn,{size:"xs",radius:0,autosize:!0,minRows:1,maxRows:10,value:n[a],onChange:l=>{s(a,l.currentTarget.value)}})})]}))})};tg.id=eg;function Dw(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}si();Se();var Iw="ExportSheetModal";function Aw(){let t=wt(),e=ot();return{open:n=>{t.openContextModal(Iw,{...e,title:"Export to Google Sheet",innerProps:n,size:"650px"})}}}function ng(t){let{innerProps:e,context:n,id:o}=t,[r,i]=L(!1),[s,a]=L("new-sheet"),[l,c]=L(""),[d,u]=L(!1),p=aa(),h=lw(),g=J(),m=FC(h.settings.googleDriveFolder),_=[{value:"new-sheet",label:"Create Google Sheet",help:"Creates a new Google Sheet and exports strings to the sheet."},{value:"add-tab",label:"Add tab in Google Sheet",help:"Adds a new tab in an existing Google Sheet and exports strings to the sheet."},{value:"link-sheet",label:"Link Google Sheet",help:"Links an existing Google Sheet without exporting strings."}],b=!1;(s==="add-tab"||s==="link-sheet")&&(b=!0,l&&Rd(l)?.spreadsheetId&&(b=!1));async function y(k,T){let w=T?.isNew||!1,{headers:S,rows:N}=e.csvData;w?(await k.replaceSheet(S,N),await k.applyL10nTheme()):await k.updateValuesMap(N,{keyedBy:"source",preserveColumns:e.locales})}async function v(){p.isLoggedIn()||await p.login();let k=window.__ROOT_CTX.rootConfig,T=k.projectName||k.projectId||"Root CMS",w,S,N="create-google-sheet";try{if(ae({id:N,loading:!0,title:"Creating Google Sheet...",message:"Creating Google Sheet for localization.",autoClose:!1,disallowClose:!0}),w=await ta.create({title:`${T} Localization`,parent:m,share:g.current?.checked}),S=await w.getSheet(0),!S)throw new Error("could not find sheet gid=0");S.setTitle(e.docId)}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),Tt({id:N,title:"Failed to create Google Sheet",message:String(O),color:"red",autoClose:!1});return}try{Tt({id:N,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let D={spreadsheetId:w.spreadsheetId,gid:0};await Bd(e.docId,D)}catch(D){console.error(D),Tt({id:N,title:"Failed to link Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{Tt({id:N,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(S,{isNew:!0})}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),Tt({id:N,title:"Failed to export strings to Google Sheet",message:O,color:"red",autoClose:!1});return}c(S.getUrl()),u(!0),Tt({id:N,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function x(){p.isLoggedIn()||await p.login();let k=Rd(l);if(!k?.spreadsheetId)throw new Error("failed to parse spreadsheet id");let T=new ta(k.spreadsheetId),w,S="add-tab-google-sheet";try{ae({id:S,loading:!0,title:"Creating tab in Google Sheet...",message:"Adding tab in existing Google Sheet",autoClose:!1,disallowClose:!0}),w=await T.createSheet({title:e.docId})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),Tt({id:S,title:"Failed to create Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{Tt({id:S,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let N={spreadsheetId:T.spreadsheetId,gid:w.gid};await Bd(e.docId,N)}catch(N){console.error(N),Tt({id:S,title:"Failed to link Google Sheet",message:String(N),color:"red",autoClose:!1});return}try{Tt({id:S,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(w,{isNew:!0})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),Tt({id:S,title:"Failed to export strings to Google Sheet",message:D,color:"red",autoClose:!1});return}u(!0),Tt({id:S,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function C(){let k="link-google-sheet",T=Rd(l);if(!T?.spreadsheetId)throw new Error("failed to parse spreadsheet id");try{ae({id:k,loading:!0,title:"Link Google Sheet",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0}),await Bd(e.docId,T)}catch(w){console.error(w),Tt({id:k,title:"Failed to link Google Sheet",message:String(w),color:"red",autoClose:!1});return}u(!0),Tt({id:k,title:`Done! Linked ${e.docId} to Google Sheet.`,message:na(T),autoClose:!1})}async function E(){console.log(s),i(!0),s==="new-sheet"?await br(v):s==="add-tab"?await br(x):s==="link-sheet"&&await br(C),i(!1)}return f("div",{className:"ExportSheetModal",children:f("div",{className:"ExportSheetModal__content",children:[f("div",{className:"ExportSheetModal__content__body",children:"Export strings to Google Sheet or link an existing Google Sheet for managing translations."}),f("form",{className:"ExportSheetModal__form",children:[f("div",{className:"ExportSheetModal__form__section",children:[f("div",{className:"ExportSheetModal__form__description",children:"Export options:"}),f(Ln,{disabled:d||r,itemComponent:ng.SelectItem,data:_,onChange:k=>{a(k),k==="new-sheet"&&c("")},value:s})]}),f("div",{className:"ExportSheetModal__form__section",children:[f("div",{className:"ExportSheetModal__form__description",children:"Google Sheet URL:"}),s==="new-sheet"?f(Jn,{disabled:!0,placeholder:h.settings.googleDriveFolder?"A new Google Sheet will be created in the project's Google Drive folder.":'A new Google Sheet will be created in your "My Drive" folder.'}):f(Jn,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:l,disabled:d||r,onChange:k=>c(k.currentTarget.value)})]}),s==="new-sheet"&&f("div",{className:"ExportSheetModal__form__section",children:f(De,{label:"Whether to share the Google Sheet with Admins and Editors upon creation. If your site has a Google Drive folder configured, the sheet will be created within it and inherit its permissions.",wrapLines:!0,width:320,withArrow:!0,position:"bottom",children:f(uo,{disabled:d||r,ref:g,name:"share",value:"true",label:"Share Google Sheet with collaborators",defaultChecked:!m})})}),f("div",{className:"ExportSheetModal__form__buttons",children:d?f(ke,{children:[f(Z,{component:"a",target:"_blank",rel:"noopener noreferrer",href:l,variant:"default",size:"xs",color:"dark",rightIcon:f(vr,{size:16}),children:"Open Google Sheet"}),f(Z,{variant:"filled",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"primary",children:"Done"})]}):f(ke,{children:[f(Z,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),f(Z,{variant:"filled",size:"xs",color:"primary",loading:r,disabled:b,onClick:()=>E(),children:s==="link-sheet"?"Link Google Sheet":"Export to Google Sheet"})]})})]})]})})}ng.SelectItem=Go(t=>{let{label:e,help:n,...o}=t;return f("div",{className:"ExportSheetModal__SelectItem",...o,children:[f(ns,{className:"ExportSheetModal__SelectItem__label",size:"body",children:e}),f(ns,{className:"ExportSheetModal__SelectItem__help",size:"body-sm",children:n})]})});ng.id=Iw;Se();Se();function Mw(t){let{labels:e}=t,[n,o]=L(0);return F(()=>{let r=setTimeout(()=>{o(i=>(i+1)%e.length)},2e3);return()=>clearTimeout(r)},[n,e.length]),f("div",{className:"ProgressiveLoader",children:[f(Ft,{color:"gray",size:"md"}),f("div",{className:"ProgressiveLoader__labels",children:f(pn,{size:"sm",color:"dimmed",className:"ProgressiveLoader__label--entering",children:e[n]},n)})]})}var Lw="LocalizationModal";function Rw(){let t=wt(),e=ot();return{open:n=>{let o=new URLSearchParams(window.location.search);o.set("modal","localization"),window.history.replaceState(null,"",`${window.location.pathname}?${o}`),t.openContextModal(Lw,{...e,innerProps:n,size:"clamp(80%, 1024px, 1280px)",onClose:()=>{n.draft?.flush({quiet:!0});let r=new URLSearchParams(window.location.search);r.delete("modal");let i=r.toString()?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,"",i)}})}}}function qo(t){let e=t.innerProps;return f("div",{className:"LocalizationModal",children:f("div",{className:"LocalizationModal__layout",children:[f(qo.ConfigLocales,{...e}),f(qo.Translations,{...e})]})})}qo.id=Lw;qo.ConfigLocales=t=>{let[e,n]=L(()=>t.draft?t.draft.getLocales():["en"]),o=window.__ROOT_CTX.rootConfig.i18n||{},r=o.locales||["en"],i=o.groups||{default:{label:"",locales:r}};function s(c){return e.filter(d=>(i[c].locales||[]).includes(d))}function a(c,d){let u=new Set(e),p=i[c].locales||[];for(let g of p)d.includes(g)?u.add(g):u.delete(g);let h=Array.from(u.values()).sort();l(h)}function l(c){n(c),t.draft.setLocales(c)}return f("div",{className:"LocalizationModal__locales",children:f(po,{spacing:30,children:[f(fn,{children:[f(Cr,{className:"LocalizationModal__iconTitle LocalizationModal__locales__title",size:"h2",children:[f(FE,{strokeWidth:1.5}),f("span",{children:"Locales"})]}),f(qo.AllNoneButtons,{onAllClicked:()=>l(r),onNoneClicked:()=>l([])})]}),f(po,{spacing:40,children:Object.keys(i).map(c=>{let d=i[c],u=s(c);return f(qo.LocaleGroup,{group:d,groupEnabledLocales:u,allEnabledLocales:e,onChange:p=>a(c,p)})})})]})})};qo.LocaleGroup=t=>{let e=t.groupEnabledLocales||[],n=t.group.locales||[],o=t.allEnabledLocales||[];function r(s){t.onChange&&t.onChange(s)}function i(s){let a=e.indexOf(s);a===-1?e.push(s):e.splice(a,1),r(e)}return f(po,{spacing:16,children:[t.group.label&&f(fn,{position:"apart",children:[f(Cr,{size:"h4",weight:"semi-bold",children:t.group.label}),f(qo.AllNoneButtons,{onAllClicked:()=>r(n),onNoneClicked:()=>r([])})]}),f(fn,{children:n.map(s=>{let a=e.includes(s),l=o.length<=1&&a;return f(uo,{value:s,checked:a,disabled:l,label:Pw(s),onChange:()=>i(s),size:"xs"})})})]})};qo.AllNoneButtons=t=>f(fn,{spacing:"8px",children:[f(Z,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onAllClicked,children:"All"}),"/",f(Z,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onNoneClicked,children:"None"})]});qo.Translations=t=>{let[e,n]=L(!0),[o,r]=L([]),i=window.__ROOT_CTX.rootConfig.i18n?.locales||[],s=Ll(i),a=t.locale&&YC(t.locale)||s.find(H=>H!=="en")||"en",[l,c]=L(a),[d,u]=L(!1),[p,h]=L({}),g=X(()=>{if(!l)return{};let H={};return Object.values(p).forEach(ne=>{H[ne.source]=Rl(ne,l)}),H},[l,p]),m=aa(),[_,b]=L(null),y=Aw(),v=uw(),[x,C]=L(new Set),E=x.size,[k,T]=L({}),[w,S]=L(!1),[N,D]=L(!1),[O,A]=L(null),I=J(!1),R=J(null),$=Object.keys(k).length;function W(H,ne,Ce){T(de=>{let ye={...de};ye[H]||(ye[H]={}),ye[H]={...ye[H],[ne]:Ce};let je=g[H]||"";return Ce===je&&(delete ye[H][ne],Object.keys(ye[H]).length===0&&delete ye[H]),ye})}async function P(){S(!0);try{let H=Object.entries(k).map(([de,ye])=>({source:de,locales:ye}));await JC(H,{tags:[t.docId]});let ne=await Promise.all(H.map(async de=>({hash:await xr(de.source),source:de.source,locales:de.locales}))),Ce=[t.docId];h(de=>{let ye={...de};for(let{hash:je,source:Ot,locales:Pt}of ne){let un=ye[je],ti=un?.tags||[],An=Array.from(new Set([...ti,...Ce]));un?ye[je]={...un,...Pt,tags:An}:ye[je]={source:Ot,...Pt,tags:An}}return ye}),T({}),ae({title:"Saved!",message:`Updated ${H.length} translation(s).`,autoClose:2500})}catch(H){console.error(H),ae({title:"Error saving translations",message:String(H),color:"red",autoClose:!1})}S(!1)}function q(){return!No()||!l?!1:o.some(H=>{let ne=k[H]?.[l];return ne!==void 0?!ne:!g[H]})}function ce(){I.current=!0,R.current?.abort()}async function rt(){if(!(!l||o.length===0)){I.current=!1,D(!0);try{for(let H of o){if(I.current)break;if(k[H]?.[l]||g[H])continue;A(H);let Ce=new AbortController;R.current=Ce;let de={},ye=_t[H];ye&&i.forEach(Pt=>{ye[Pt]&&(de[Pt]=ye[Pt])});let je=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:H,targetLocales:[l],existingTranslations:de}),signal:Ce.signal});if(je.status!==200){let Pt=await je.text();throw new Error(`Translation failed: ${Pt}`)}let Ot=await je.json();Ot.success&&Ot.translations?.[l]&&W(H,l,Ot.translations[l])}I.current?ae({message:"AI translation stopped",color:"yellow"}):ae({message:"Finished generating AI translations",color:"green"})}catch(H){H instanceof DOMException&&H.name==="AbortError"||(console.error(H),ae({title:"Error generating translations",message:String(H),color:"red"}))}finally{D(!1),A(null),I.current=!1,R.current=null}}}let Et=J(!1);F(()=>{if(e)return;if(!Et.current){Et.current=!0;return}let H=!1;async function ne(){let Ce=[t.docId],de=await Promise.all(o.map(async je=>({source:je,hash:await xr(je)})));if(H)return;let ye=new Set;for(let{source:je,hash:Ot}of de)if(p[Ot]){let Pt=p[Ot].tags||[];Ce.every(ti=>Pt.includes(ti))||ye.add(je)}H||C(ye)}return ne(),()=>{H=!0}},[t.docId,o,p,e]);let _t=X(()=>{let H={};return Object.values(p).forEach(ne=>{H[ne.source]=ne}),H},[p]),dt=s.map(H=>({value:H,label:Pw(H)})),ut=X(()=>!l||o.length===0?0:o.filter(H=>{let ne=k[H]?.[l];return ne!==void 0?!ne:!g[H]}).length,[o,g,l,k]);F(()=>{n(!0),Promise.all([cw(t.docId),Fd(),rE(t.docId)]).then(async([H,ne,Ce])=>{let de=[t.docId],ye=await Promise.all(H.map(async Ot=>({source:Ot,hash:await xr(Ot)}))),je=new Set;for(let{source:Ot,hash:Pt}of ye)if(ne[Pt]){let un=ne[Pt].tags||[];de.every(An=>un.includes(An))||je.add(Ot)}r(H),h(ne),b(Ce),C(je),n(!1)}).catch(H=>{console.error("Failed to load translations:",H),n(!1),ae({title:"Error",message:String(H?.message||H),color:"red",autoClose:!1})})},[t.docId]);function re(H,ne){let Ce=_t[H];return Ce?Rl(Ce,ne):""}function ee(){let H=Ll(i.filter(de=>!GC(de))).filter(de=>de!=="en"),ne=["source","en",...H],Ce=[];return o.forEach(de=>{let ye={source:de,en:re(de,"en")||de};H.forEach(je=>{ye[je]=re(de,je)}),Ce.push(ye)}),{headers:ne,rows:Ce}}async function be(){let{headers:H,rows:ne}=ee(),Ce=await window.fetch("/cms/api/csv.download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:H,rows:ne})});if(Ce.status!==200){console.error("csv.download failed:");let je=await Ce.text();console.error(je)}let de=await Ce.blob(),ye=window.URL.createObjectURL(de);window.location.assign(ye),window.URL.revokeObjectURL(ye)}async function Fe(){let H=document.createElement("input");H.type="file",H.accept=".csv",H.addEventListener("change",async()=>{let ne=H.files?.[0];if(ne){let Ce=new FormData;Ce.append("file",ne);try{let de=await fetch("/cms/api/csv.import",{method:"POST",body:Ce});if(de.status!==200){let Ot=await de.text();throw new Error(`RPCError: ${Ot}`)}let ye=(await de.json()).data,je=await oa(t.docId,ye);h(Ot=>og(Ot,je)),ae({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}catch(de){console.error(de),ae({title:"Failed to import CSV",message:String(de),color:"red",autoClose:!1})}}}),H.click()}async function dn(){if(m.isLoggedIn()||await m.login(),!_?.spreadsheetId)throw new Error("no sheet linked");let ne=await new ta(_.spreadsheetId).getSheet(_.gid??0);if(!ne)throw new Error(`sheet not found: ${JSON.stringify(_)}`);await Be(ne),ae({title:"Exported strings to Google Sheet",message:ne.getUrl(),autoClose:!1})}async function Be(H,ne){let Ce=ne?.isNew||!1,{headers:de,rows:ye}=ee();Ce?(await H.replaceSheet(de,ye),await H.applyL10nTheme()):await H.updateValuesMap(ye,{keyedBy:"source",preserveColumns:s}),Ld("doc.export_to_sheet",{metadata:{docId:t.docId,sheetId:{spreadsheetId:H.spreadsheet.spreadsheetId,gid:H.gid}}})}async function nn(){if(m.isLoggedIn()||await m.login(),!_?.spreadsheetId)throw new Error("no sheet linked");let ne=await new ta(_.spreadsheetId).getSheet(_.gid??0);if(!ne)throw new Error(`sheet not found: ${JSON.stringify(_)}`);console.log("importing google sheet");let Ce=await ne.getValuesMap(),de=await oa(t.docId,Ce);h(ye=>og(ye,de)),ae({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}async function Sl(){await oE(t.docId),b(null),ae({title:"Unlinked Google Sheet",message:`${t.docId} is no longer connected to a Google Sheet.`,autoClose:5e3})}async function Th(){n(!0);let H=[],ne=[t.docId];for(let Ce of o){let de=await xr(Ce);if(p[de]){let ye=p[de].tags||[],je=Array.from(new Set([...ye,...ne]));H.push({hash:de,tags:je})}}H.length>0?(await Lh(H,{mode:"union"}),h(Ce=>{let de={...Ce};return H.forEach(({hash:ye,tags:je})=>{de[ye]&&(de[ye]={...de[ye],tags:je})}),de}),ae({title:"Tags Applied",message:`Applied tag "${t.docId}" to ${H.length} string(s).`,color:"green"})):ae({title:"No strings updated",message:"No existing translations found to tag.",color:"blue"}),n(!1)}async function on(H){try{await H()}catch(ne){console.error(ne);let Ce;typeof ne=="object"&&ne.body?Ce=String(ne.body):Ce=String(ne),ae({title:"Error",message:Ce,color:"red",autoClose:!1})}}function Cd(H){switch(H){case"EXPORT_DOWNLOAD_CSV":{on(be);return}case"EXPORT_GOOGLE_SHEET_LINKED":{on(dn);return}case"EXPORT_GOOGLE_SHEET_SHOW_OPTIONS":{y.open({docId:t.docId,csvData:ee(),locales:s});return}case"IMPORT_CSV":{on(Fe);return}case"IMPORT_GOOGLE_SHEET_LINKED":{on(nn);return}case"UNLINK_GOOGLE_SHEET":{on(Sl);return}default:console.log("unhandled action: "+H)}}async function Ed(H,ne){let de=(window.__ROOT_CTX.translations||[]).find(ye=>ye.id===H)?.label||H;await on(async()=>{let ye=ne==="export"?await dw(t.docId):null,je=o.map(un=>{let ti={};s.forEach(jt=>{ti[jt]=re(un,jt)??""});let An=ye?.get(un)?.description;return{source:un,translations:ti,...An?{description:An}:{}}}),Ot=ne==="import"||ne==="export"?ne:(()=>{throw new Error("Invalid translations action")})(),Pt=`translations-${Ot}-${H}`;ae({id:Pt,message:ne==="import"?`Importing from ${de}...`:`Exporting to ${de}...`,loading:!0,autoClose:!1,disallowClose:!0});try{let un=await window.fetch(`/cms/api/translations.${Ot}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:H,docId:t.docId,data:je})});if(!(un.headers.get("content-type")||"").includes("application/json"))throw new Error(`Unexpected response (${un.status}). Please reload the page and try again.`);let An=await un.json();if(!An.success)throw new Error(An.error||"Unknown error");if(ne==="import")if(Array.isArray(An.data)){let jt=An.data.map(ni=>{let Wo={source:String(ni?.source??"")},oi=ni?.translations;return oi&&typeof oi=="object"&&Object.entries(oi).forEach(([Zs,Nl])=>{Nl!=null&&qC(Zs).length!==0&&(Wo[Zs]=String(Nl))}),Wo}),kl=await oa(t.docId,jt,{actionMetadata:{service:H,numStrings:jt.length,locales:i},actionLinks:[{label:"Open translations",url:`/cms/content/${t.docId}?modal=localization`}]});h(ni=>og(ni,kl));let qi=[t.docId],Mn=[];for(let ni of jt){let Wo=await xr(ni.source),Zs=p[Wo]?.tags||[],Nl=Array.from(new Set([...Zs,...qi]));Mn.push({hash:Wo,tags:Nl})}Mn.length>0&&(await Lh(Mn,{mode:"union"}),h(ni=>{let Wo={...ni};return Mn.forEach(({hash:oi,tags:Zs})=>{Wo[oi]&&(Wo[oi]={...Wo[oi],tags:Zs})}),Wo})),Tt({id:Pt,title:"Imported!",message:`Imported translations from ${de}.`,loading:!1,autoClose:5e3})}else{let jt=An.data||{},kl=jt.title||"Import complete",qi=jt.message||`Imported translations from ${de}.`,Mn=jt.link;Tt({id:Pt,title:kl,color:jt.status==="success"?"green":jt.status==="error"?"red":void 0,message:Mn?.url?f("div",{children:[f("div",{children:qi}),f(Z,{component:"a",href:Mn.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:f(ra,{size:14}),style:{marginTop:"8px"},children:Mn.label||"Open"})]}):qi,loading:!1,autoClose:Mn?.url?1e4:5e3})}else{let jt=An.data||{},kl=jt.title||"Exported!",qi=jt.message||`Exported translations to ${de}.`,Mn=jt.link;Tt({id:Pt,title:kl,color:jt.status==="success"?"green":jt.status==="error"?"red":void 0,message:Mn?.url?f("div",{children:[f("div",{children:qi}),f(Z,{component:"a",href:Mn.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:f(ra,{size:14}),style:{marginTop:"8px"},children:Mn.label||"Open"})]}):qi,loading:!1,autoClose:Mn?.url?1e4:5e3})}}catch(un){throw Ol(Pt),un}})}return f("div",{className:"LocalizationModal__translations",children:[f("div",{className:"LocalizationModal__translations__topWrapper",children:[f("div",{className:"LocalizationModal__translations__header",children:[f("div",{className:"LocalizationModal__translations__titleWrap",children:f(Cr,{className:"LocalizationModal__translations__title LocalizationModal__iconTitle",size:"h2",children:[f(es,{strokeWidth:1.5})," ",f("span",{children:"Translations"})]})}),f("div",{className:"LocalizationModal__translations__header__buttons",children:[m.enabled&&_?.spreadsheetId&&f(De,{label:"Open Google Sheet",children:f(Ae,{component:"a",href:na(_),target:"_blank",variant:"filled",color:"green",size:"sm",children:f(ou,{size:16,strokeWidth:2.25})})}),f(Z,{component:"a",href:`/cms/translations/${t.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:f(ra,{size:14,strokeWidth:1.75}),children:"Open Editor"}),f(yP,{onAction:Cd,onServiceAction:Ed,gapiClient:m,linkedSheet:_}),f(xP,{onAction:Cd,onServiceAction:Ed,gapiClient:m,linkedSheet:_}),f(G,{className:"LocalizationModal__translations__menu",control:f(De,{label:"Tools",children:f(Ae,{className:"LocalizationModal__translations__menu__dots",variant:"default",children:f($l,{size:16})})}),size:220,children:f(G.Item,{className:"LocalizationModal__translations__menu__item",icon:f(jE,{size:16}),onClick:()=>v.open({docId:t.docId,sourceStrings:o,onPruned:H=>{h(ne=>{let Ce={...ne};return H.forEach(de=>delete Ce[de]),Ce})}}),children:"Prune unused strings"})})]})]}),e&&f(Mw,{labels:["Transmogrifying...","Deciphering the vibes...","Consulting the Rosetta Stone...","Untangling the syntax...","Babel-ing..."]}),!e&&E>0&&f("div",{className:"LocalizationModal__missingTags",children:[f("div",{className:"LocalizationModal__missingTags__message",children:[f(Ph,{}),E>1?f(pn,{size:"sm",children:[f("b",{children:[E," strings"]}),' are missing the "',t.docId,'" tag.']}):f(pn,{size:"sm",children:[f("b",{children:[E," string"]}),' is missing the "',t.docId,'" tag.']})]}),f(Z,{variant:"filled",size:"xs",onClick:()=>on(Th),loading:e,leftIcon:f($l,{size:16}),children:"Fix missing tags"})]}),!e&&f("table",{className:"LocalizationModal__translations__table",children:[f("tr",{className:"LocalizationModal__translations__table__row LocalizationModal__translations__table__row--header",children:[f("th",{className:"LocalizationModal__translations__table__header",children:f(Cr,{size:"h4",weight:"semi-bold",children:"SOURCE STRING"})}),f("th",{className:"LocalizationModal__translations__table__header",children:f("div",{className:"LocalizationModal__translations__localeHeader",children:[f(Cr,{className:"LocalizationModal__translations__localeSelect",size:"h4",weight:"semi-bold",children:[f("span",{children:"LOCALE: "})," ",f(Ln,{data:dt,size:"xs",placeholder:"select locale",allowDeselect:!0,value:l,onChange:H=>c(H)})]}),f("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[l&&ut>0&&f(De,{label:d?"Show all translations":"Show only missing translations",position:"top",withArrow:!0,children:f("button",{className:`LocalizationModal__translations__missingToggle${d?" LocalizationModal__translations__missingToggle--active":""}`,onClick:()=>u(H=>!H),children:[f(vE,{size:14}),f("span",{children:[ut," missing"]})]})},d?"active":"inactive"),l&&o.length>0&&ut===0&&$===0&&f("div",{className:"LocalizationModal__translations__fullyTranslated",children:[f(Qi,{size:14}),f("span",{children:"Translated"})]}),q()&&!N&&f(De,{label:"Generate translations using AI",withArrow:!0,position:"top",children:f(Ae,{variant:"default",size:"sm",onClick:rt,children:f(ko,{size:14,fill:"black"})})}),N&&f(De,{label:"Stop generating",withArrow:!0,position:"top",children:f(Ae,{variant:"default",size:"sm",onClick:ce,children:f(HE,{size:14,fill:"black"})})}),N&&f(Jd,{size:18,className:"LocalizationModal__spinner"})]})]})})]}),o.filter(H=>!d||!l?!0:!g[H]).map((H,ne)=>f("tr",{className:"LocalizationModal__translations__table__row",children:[f("td",{className:"LocalizationModal__translations__table__col",children:f("div",{className:"LocalizationModal__sourceCell",children:[f("span",{className:"LocalizationModal__sourceCell__text",children:H}),(_t[H]||x.has(H))&&f("div",{className:"LocalizationModal__sourceCell__icons",children:[_t[H]&&f(Ae,{className:"LocalizationModal__sourceCell__link",size:"sm",variant:"subtle",onClick:async()=>{let Ce=await xr(H);window.open(`/cms/translations/${Ce}`,"_blank")},children:f(vr,{size:16})}),x.has(H)&&f(De,{label:`Missing "${t.docId}" tag`,position:"top",withArrow:!0,children:f(Ae,{className:"LocalizationModal__sourceCell__missingTag",size:"sm",variant:"subtle",children:f(Ph,{size:14})})})]})]})}),f("td",{className:"LocalizationModal__translations__table__col",children:f(bP,{source:H,locale:l,savedValue:g[H]||"",pendingValue:k[H]?.[l],isAiGenerating:O===H,readOnly:N,onEdit:Ce=>W(H,l,Ce)})})]},ne))]})]}),f("div",{className:"LocalizationModal__translations__saveBar",children:[f("span",{className:"LocalizationModal__translations__saveBar__status",children:$>0?`${$} unsaved change${$!==1?"s":""}`:""}),$>0&&f(Z,{variant:"default",size:"xs",leftIcon:f(li,{size:14}),onClick:()=>T({}),children:"Discard changes"}),f(Z,{variant:"filled",size:"xs",color:"dark",leftIcon:f(Qi,{size:14}),onClick:P,loading:w,disabled:$===0,children:"Save"})]})]})};function bP(t){let e=t.pendingValue!==void 0?t.pendingValue:t.savedValue,o=[t.pendingValue!==void 0?"LocalizationModal__translations__cell--edited":"",t.isAiGenerating?"LocalizationModal__translations__cell--ai-generating":"",e?"":"LocalizationModal__translations__cell--empty"].filter(Boolean).join(" ")||void 0;return f(bn,{size:"xs",autosize:!0,minRows:1,value:e,placeholder:"",readOnly:t.readOnly,onChange:r=>t.onEdit(r.currentTarget.value),className:o,styles:{root:{height:"100%"},wrapper:{height:"100%"},input:{fontSize:"12px",minHeight:"100%"}}})}function yP(t){function e(r){t.onAction&&t.onAction(r)}let n=t.linkedSheet,o=(window.__ROOT_CTX.translations||[]).filter(r=>r.hasImport);return f(G,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"end",control:f(Z,{variant:"default",color:"dark",size:"xs",leftIcon:f(Pl,{size:16,strokeWidth:1.75}),rightIcon:f(fo,{size:16,strokeWidth:1.75}),children:"Import"}),children:[t.gapiClient.enabled&&f(ke,{children:[f(G.Label,{children:"Google Sheets"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",disabled:!n?.spreadsheetId,onClick:()=>e("IMPORT_GOOGLE_SHEET_LINKED"),children:"Import Google Sheet"}),f(_r,{})]}),f(G.Label,{children:"File"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("IMPORT_CSV"),children:"Import .csv"}),o.length>0&&f(ke,{children:[f(_r,{}),f(G.Label,{children:"Services"}),o.map(r=>f(G.Item,{className:"LocalizationModal__translations__menu__item",icon:r.icon?f("img",{src:r.icon,alt:r.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(r.id,"import"),children:["Import from ",r.label]},r.id))]})]})}function xP(t){async function e(i){t.onAction&&t.onAction(i)}let o=!!t.linkedSheet?.spreadsheetId,r=(window.__ROOT_CTX.translations||[]).filter(i=>i.hasExport);return f(G,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"start",control:f(Z,{variant:"default",color:"dark",size:"xs",leftIcon:f(xE,{size:16,strokeWidth:1.75}),rightIcon:f(fo,{size:16,strokeWidth:1.75}),children:"Export"}),children:[t.gapiClient.enabled&&f(ke,{children:[f(G.Label,{children:"Google Sheets"}),o?f(ke,{children:f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_LINKED"),children:"Export to Google Sheet"})}):f(ke,{children:f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_SHOW_OPTIONS"),children:"Export to Google Sheet"})}),f(_r,{})]}),f(G.Label,{children:"File"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_DOWNLOAD_CSV"),children:"Download .csv"}),r.length>0&&f(ke,{children:[f(_r,{}),f(G.Label,{children:"Services"}),r.map(i=>f(G.Item,{className:"LocalizationModal__translations__menu__item",icon:i.icon?f("img",{src:i.icon,alt:i.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(i.id,"export"),children:["Export to ",i.label]},i.id))]}),o&&f(ke,{children:[f(_r,{}),f(G.Label,{children:"Danger zone"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("UNLINK_GOOGLE_SHEET"),color:"red",children:"Unlink Google Sheet"})]})]})}function og(t,e){let n={...t};for(let[o,r]of Object.entries(e)){let i=n[o];n[o]=i?{...i,...r}:r}return n}function Pw(t){let e=t.split("_"),n=e[0];if(n==="ALL"){let i=String(e[1]).toUpperCase();return`${new Intl.DisplayNames(["en"],{type:"region"}).of(i)||t} (${t})`}return`${new Intl.DisplayNames(["en"],{type:"language"}).of(n)||t} (${t})`}Se();function Fw(t){let e=new Set;return rg(t,e),Array.from(e)}function rg(t,e){if(!(!t||typeof t!="object")){if(Array.isArray(t)){for(let n of t)rg(n,e);return}if(vP(t)){e.add(t.id);return}for(let n of Object.keys(t))rg(t[n],e)}}function vP(t){return typeof t.id=="string"&&typeof t.collection=="string"&&typeof t.slug=="string"&&t.id.includes("/")}var Bw="PublishDocModal";function $w(t){let e=wt(),n=ot();return{open:()=>{e.openContextModal(Bw,{...n,title:`Publish ${t.docId}`,innerProps:t,size:"850px"})}}}function CP(t){let{innerProps:e,context:n,id:o}=t,[r,i]=L(""),[s,a]=L(""),[l,c]=L(!1),[d,u]=L(""),[p,h]=L(!1),g=J(null),m=wt(),_=ot(),b=No(),{roles:y,loading:v}=iu(),x=window.firebase.user.email||"",C=su(y,x),E=r==="scheduled"?"Schedule":"Publish";async function k(){try{c(!0),await XC(e.docId,{publishMessage:d.trim()||void 0}),c(!1),ae({title:"Published!",message:`Succesfully published ${e.docId}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=Il(D);ae({title:"Publish failed",message:`Failed to publish ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function T(){try{c(!0);let D=Math.floor(new Date(s).getTime());await ZC(e.docId,D,{publishMessage:d.trim()||void 0}),c(!1),ae({title:"Scheduled!",message:`${e.docId} will go live ${s}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=Il(D);ae({title:"Schedule failed",message:`Failed to schedule ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function w(){try{h(!0);let O=await(await window.fetch("/cms/api/ai.publish_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({docId:e.docId})})).json();O.success&&O.message?u(O.message):ae({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}catch(D){console.error(D),ae({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}finally{h(!1)}}function S(){m.openConfirmModal({..._,title:`${E} ${e.docId}`,children:f(ke,{children:[f(ns,{size:"body-sm",weight:"semi-bold",className:"PublishDocModal__confirmText",children:["Are you sure you want to publish the following doc? The doc will go live ",r==="now"?"now":`at ${s}`,"."]}),f(pw,{docId:e.docId})]}),labels:{confirm:E,cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{r==="now"?k():r==="scheduled"&&T()}})}let N=!0;return(r==="now"||r==="scheduled"&&s)&&(N=!1),(v||!C)&&(N=!0),f("div",{className:"PublishDocModal",children:f("div",{className:"PublishDocModal__content",children:[f("form",{className:"PublishDocModal__form",onSubmit:D=>{D.preventDefault(),S()},children:[f("div",{className:"PublishDocModal__form__publishOptions",children:f("div",{className:"PublishDocModal__form__publishOptions__options",children:[f("label",{className:xe("PublishDocModal__form__publishOptions__option",r==="now"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="now"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[f("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[f("input",{type:"radio",name:"publish-option",value:"now",checked:r==="now",onChange:()=>i("now")})," ","Now"]}),f("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live immediately."})]}),f("label",{className:xe("PublishDocModal__form__publishOptions__option",r==="scheduled"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="scheduled"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[f("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[f("input",{type:"radio",name:"publish-option",value:"scheduled",checked:r==="scheduled",onChange:()=>i("scheduled")}),f("div",{children:"Scheduled"})]}),f("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live at the date and time specified below."}),f("div",{className:"PublishDocModal__form__publishOptions__option__input2",children:[f("input",{ref:g,type:"datetime-local",disabled:r!=="scheduled",value:s,min:PC(),onChange:D=>{let O=D.target;a(O.value)}}),f("div",{className:"PublishDocModal__form__publishOptions__option__input2__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})]})]})}),f("div",{className:"PublishDocModal__form__publishMessage",children:f("div",{className:"PublishDocModal__form__publishMessage__wrapper",children:[f("textarea",{className:"PublishDocModal__form__publishMessage__textarea",placeholder:"Optional: Add a message to describe the changes",value:d,rows:3,onInput:D=>{let O=D.target;u(O.value)}}),b&&f("button",{type:"button",className:"PublishDocModal__form__publishMessage__sparkle",onClick:w,disabled:p,children:f(De,{label:"Generate message",withArrow:!0,position:"left",allowPointerEvents:!0,wrapLines:!0,children:p?f(Ft,{size:16}):f(ko,{size:16,stroke:1.5})})})]})}),f("div",{className:"PublishDocModal__form__buttons",children:[f(Z,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),f(Z,{variant:"filled",size:"xs",color:"dark",disabled:N,loading:l,type:"submit",children:E})]})]}),f("div",{className:"PublishDocModal__DiffWrapper",children:[f(TP,{docId:e.docId}),b&&f(hw,{docId:e.docId,beforeVersion:"published",afterVersion:"draft"}),f(EP,{docId:e.docId})]})]})})}function EP(t){let e=t.docId,[n,o]=L(!1);function r(){o(!0)}return f("div",{className:"PublishDocModal__ShowChanges",children:f(Oh,{iconPosition:"right",onChange:()=>r(),disableIconRotation:!0,children:f(Oh.Item,{label:"Compare JSON data",icon:f(CE,{stroke:1.5}),iconPosition:"left",children:n&&f(gw,{left:{docId:e,versionId:"published"},right:{docId:e,versionId:"draft"},showExpandButton:!0,showAiSummary:!1})})})})}function wP(t){let e=t?.sys;return e?!!(!e.publishedAt||e.modifiedAt&&e.modifiedAt>e.publishedAt):!1}function TP(t){let[e,n]=L(!0),[o,r]=L([]);F(()=>{async function a(){n(!0);try{let l=await Al(t.docId);if(!l?.fields){n(!1);return}let c=Fw(l.fields).filter(u=>u!==t.docId);if(c.length===0){n(!1);return}let d=[];await Promise.all(c.map(async u=>{try{let p=await Al(u);p&&wP(p)&&d.push(u)}catch(p){console.warn(`Failed to fetch reference doc: ${u}`,p)}})),r(d.sort())}catch(l){console.error("Failed to load reference docs",l)}n(!1)}a()},[t.docId]);let i=[t.docId,...o],s=lE({docIds:i});return e?f("div",{className:"PublishDocModal__ReferenceDocs",children:f(Ft,{color:"gray",size:"sm"})}):o.length===0?null:f("div",{className:"PublishDocModal__ReferenceDocs",children:[f("div",{className:"PublishDocModal__ReferenceDocs__header",children:[f("div",{className:"PublishDocModal__ReferenceDocs__header__label",children:["Referenced docs with unpublished changes (",o.length,")"]}),f(Z,{variant:"outline",size:"xs",color:"dark",leftIcon:f(BE,{size:16}),onClick:()=>s.open(),children:"Bundle all docs into a release"})]}),f("div",{className:"PublishDocModal__ReferenceDocs__list",children:o.map(a=>f(Hd,{docId:a,variant:"compact",statusBadges:!0,clickable:!0},a))})]})}CP.id=Bw;ri();Se();function zw(t){let e=t?.scrollToDeeplink;return typeof e=="object"&&e!==null&&typeof e.deepKey=="string"}function cu(t,e){let n;return(...o)=>{window.clearTimeout(n),n=window.setTimeout(()=>{t(...o)},e)}}var ho=class{constructor(){this.events=new Map}on(e,n){let o=So(6),r=this.events.get(e);return r||(r=new Map,this.events.set(e,r)),r.set(o,n),()=>{this.off(e,o)}}off(e,n){let o=this.events.get(e);o&&(o.delete(n),o.size===0&&this.events.delete(e))}dispatch(e,...n){let o=this.events.get(e);o&&o.forEach(r=>r(...n))}dispose(){this.events.clear()}};var du=class{constructor(){this.subscribers=new Set;this.subtreeSubscribers=new Set;this.children=new Map}},uu=class extends ho{constructor(n){super();this.root=new du;this.data=n||{}}get(n){return this.getValueFromPath(n,this.data)}set(n,o){if(n===""){Rn(o)&&this.setData(o);return}this.update({[n]:o})}update(n){let o=new Map,r=(s,a,l)=>{if(o.set(s,l),!Rn(a)&&!Rn(l))return;let c=Rn(a)?Object.keys(a):[],d=Rn(l)?Object.keys(l):[];new Set([...c,...d]).forEach(p=>{let h=Rn(a)?a[p]:void 0,g=Rn(l)?l[p]:void 0;Rh(h,g)||r(`${s}.${p}`,h,g)})};Object.entries(n).forEach(([s,a])=>{let l=this.data,c=s.split("."),d=c.pop();for(let p of c)l[p]||(l[p]={}),l=l[p];let u=l[d];l[d]=a,this.dispatch("VALUE_CHANGE",s,a),r(s,u,a)});let i=new Map;o.forEach((s,a)=>{this.collectSubtreeNotifications(a,i)}),o.forEach((s,a)=>{let l=this.getTrieNode(a);l&&l.subscribers.size>0&&l.subscribers.forEach(c=>c(s))}),i.forEach((s,a)=>{let l=this.get(a);s.subtreeSubscribers.forEach(c=>c(l))}),this.dispatch("CHANGE",this.data)}setData(n){let o=this.data;this.notifyOnUpdate(this.root,"",o,n),this.data=n,this.dispatch("CHANGE",this.data)}subscribe(n,o){let r=this.getTrieNode(n,!0);return r.subscribers.add(o),window.setTimeout(()=>{let i=this.get(n);i!==void 0&&o(i)}),()=>{r.subscribers.delete(o)}}subscribeSubtree(n,o){let r=this.getTrieNode(n,!0);return r.subtreeSubscribers.add(o),window.setTimeout(()=>{let i=this.get(n);i!==void 0&&o(i)}),()=>{r.subtreeSubscribers.delete(o)}}getDataSnapshot(){return this.data}dispose(){super.dispose(),this.data={},this.root.subscribers.clear(),this.root.subtreeSubscribers.clear(),this.root.children.clear()}notifyOnUpdate(n,o,r,i){let s=this.getValueFromPath(o,r),a=this.getValueFromPath(o,i);Rh(s,a)||(n.subscribers.forEach(l=>l(a)),n.subtreeSubscribers.forEach(l=>l(a))),n.children.forEach((l,c)=>{let d=o?`${o}.${c}`:c;this.notifyOnUpdate(l,d,r,i)})}collectSubtreeNotifications(n,o){let r=this.root;if(r.subtreeSubscribers.size>0&&o.set("",r),!n)return;let i="";for(let s of n.split(".")){if(r=r.children.get(s),!r)return;i=i?`${i}.${s}`:s,r.subtreeSubscribers.size>0&&o.set(i,r)}}getValueFromPath(n,o){if(!n)return o;let r=n.split("."),i=o;for(let s of r){if(i===null||typeof i!="object"||!(s in i))return;i=i[s]}return i}getTrieNode(n,o=!1){if(!n)return this.root;let r=n.split("."),i=this.root;for(let s of r){if(!i.children.has(s))if(o)i.children.set(s,new du);else return;i=i.children.get(s)}return i}};var Hw=3*Zi.second,SP=5*Zi.minute;var kP=30*Zi.second,ig=class extends ho{constructor(n){super();this.pendingUpdates=new Map;this.saveState="NO_CHANGES";this.autolock=!1;this.autolockReason="autolock";this.autolockApplied=!1;this.mightHaveAssetChanges=!1;this.readOnly=!1;this.autoSave=!0;this.flushOnStop=!0;this.started=!1;this.queueChanges=cu(()=>this.flush(),Hw);this.projectId=window.__ROOT_CTX.rootConfig.projectId;let[o,r]=n.split("/");this.docId=n,this.collectionId=o,this.slug=r,this.db=window.firebase.db,this.docRef=Od(this.db,"Projects",this.projectId,"Collections",o,"Drafts",r),this.store=new uu({id:this.docId,collection:this.collectionId,slug:this.slug,sys:{}}),this.store.on("CHANGE",s=>{this.dispatch("CHANGE",s)}),this.store.on("VALUE_CHANGE",(s,a)=>{this.dispatch("VALUE_CHANGE",s,a)});let i=window.__ROOT_CTX.collections[o];i&&(this.autolock=!!i.autolock,i.autolockReason&&(this.autolockReason=i.autolockReason))}async start(){if(this.started)return;this.started=!0;let n=!0;this.dbUnsubscribe=Ad(this.docRef,o=>{if(o.metadata.hasPendingWrites)return;let r=o.data()||{};this.pendingUpdates.size>0&&Kw(r,Object.fromEntries(this.pendingUpdates)),this.store.setData(r),n&&(n=!1,Array.isArray(r?.sys?.assets)||(this.mightHaveAssetChanges=!0))})}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.flushOnStop&&this.flush(),this.started=!1)}onChange(n){return this.on("CHANGE",n)}onSaveStateChange(n){return this.on("SAVE_STATE_CHANGE",n)}onFlush(n){return this.on("FLUSH",n)}subscribe(n,o){return this.store.subscribe(n,o)}subscribeSubtree(n,o){return this.store.subscribeSubtree(n,o)}getData(){return this.store.getDataSnapshot()}getValue(n){return this.store.get(n)}async updateKey(n,o){this.readOnly||(o===void 0?this.setPendingUpdate(n,Md()):this.setPendingUpdate(n,o),this.store.set(n,o),this.setSaveState("UPDATE_PENDING"),this.autoSave&&this.queueChanges())}async updateKeys(n){if(!this.readOnly){for(let o in n){let r=n[o];r==null?this.setPendingUpdate(o,Md()):this.setPendingUpdate(o,r)}this.store.update(n),this.setSaveState("UPDATE_PENDING"),this.autoSave&&this.queueChanges()}}async removeKey(n){this.readOnly||(this.setPendingUpdate(n,Md()),this.store.set(n,void 0),this.setSaveState("UPDATE_PENDING"),this.autoSave&&this.queueChanges())}setPendingUpdate(n,o){for(let r of this.pendingUpdates.keys())IP(r,n)&&this.pendingUpdates.delete(r);this.pendingUpdates.set(n,o),!this.mightHaveAssetChanges&&n.startsWith("fields")&&(Mh(o)||Mh(this.store.get(n)))&&(this.mightHaveAssetChanges=!0)}getPendingUpdates(){return DP(Object.fromEntries(this.pendingUpdates))}setSaveState(n){let o=this.saveState;n==="SAVED"&&o!=="SAVING"||(this.saveState=n,n==="SAVED"&&window.setTimeout(()=>{this.saveState==="SAVED"&&this.setSaveState("NO_CHANGES")},Hw),this.dispatch("SAVE_STATE_CHANGE",n))}removePublishingLock(){this.autolockApplied=!0,this.removeKey("sys.publishingLocked"),this.flush()}async flush(n){if(this.readOnly||this.pendingUpdates.size===0)return;let o=this.getPendingUpdates();if(o["sys.modifiedAt"]=ea(),o["sys.modifiedBy"]=window.firebase.user.email,this.mightHaveAssetChanges){let r=WC(this.store.get("fields")||{}),i=this.store.get("sys.assets")||[];AP(r,i)||(o["sys.assets"]=r)}this.autolock&&!this.autolockApplied&&!this.store.get("sys.publishingLocked")&&(this.autolockApplied=!0,o["sys.publishingLocked"]={lockedAt:ea(),lockedBy:window.firebase.user.email,reason:this.autolockReason}),this.pendingUpdates.clear();try{this.setSaveState("SAVING"),await Id(this.docRef,o),this.mightHaveAssetChanges=!1,this.setSaveState("SAVED"),n?.quiet||this.dispatch("FLUSH"),Ld("doc.save",{metadata:{docId:this.docId},throttle:SP,throttleId:this.docId})}catch(r){console.error("failed to update doc:",r),this.setSaveState("ERROR");let i=Il(r);ae({title:`Failed to save ${this.slug}`,message:i||`Something went wrong while saving ${this.slug}`,color:"red",autoClose:!1});for(let s in o)s.startsWith("sys.")||this.pendingUpdates.has(s)||(this.pendingUpdates.set(s,o[s]),this.queueChanges(),console.log("re-queued updates"),console.log(this.pendingUpdates))}}getLocales(){let n=this.store.get("sys.locales");return n||["en"]}setLocales(n){this.updateKey("sys.locales",n)}async dispose(){super.dispose(),this.stop()}};function Kw(t,e){for(let n in e){let o=e[n];if(n.includes(".")){let[r,i]=NP(n);t[r]??={},Kw(t[r],{[i]:o})}else typeof o>"u"?delete t[n]:t[n]=o}}function NP(t){let e=t.indexOf("."),n=t.substring(0,e),o=t.substring(e+1);return[n,o]}function DP(t){let e={...t};for(let n in e)OP(n,e)&&delete e[n];return e}function OP(t,e){let n=t.split(".");for(let o=1;o<n.length;o++)if(n.slice(0,o).join(".")in e)return!0;return!1}function IP(t,e){return t.startsWith(`${e}.`)}function AP(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}var sg=pt(null);function jw(t){let[e,n]=L(!0),o=X(()=>new ig(t.docId),[t.docId]);o.readOnly=t.readOnly??!1,o.autoSave=t.autoSave??!0,o.flushOnStop=t.flushOnStop??!0,F(()=>(n(!0),o.onChange(i=>{n(!1),BC(i.id,i)}),o.start(),()=>o.dispose()),[o]),F(()=>{let i,s=()=>{document.hidden||document.visibilityState!=="visible"?i=window.setTimeout(()=>{o.stop()},kP):(i&&(clearTimeout(i),i=void 0),o.started||o.start())};return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s),i&&clearTimeout(i)}},[o]);let r=X(()=>({loading:e,controller:o}),[e,o]);return f(sg.Provider,{value:r,children:t.children})}function pu(t){return f(sg.Provider,{value:t.value,children:t.children})}function rn(){let t=ft(sg);if(!t)throw new Error("useDraftDoc() should be used within a <DraftDocProvider>");return t}function Vw(t){let{controller:e}=rn();F(()=>e.onSaveStateChange(t),[e])}function Nq(t){let{controller:e}=rn();F(()=>e.onChange(t),[e])}function Jo(t,e){let{controller:n}=rn();F(()=>n.subscribe(t,e),[n])}function It(t,e){let{controller:n}=rn(),[o,r]=L(n.getValue(t)??e);return F(()=>n.subscribe(t,s=>{r(s)}),[n]),[o,s=>{r(s),s==null?n.removeKey(t):n.updateKey(t,s)}]}bt();bt();function yn(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var MP=typeof Symbol=="function"&&Symbol.observable||"@@observable",Ww=MP,ag=()=>Math.random().toString(36).substring(7).split("").join("."),LP={INIT:`@@redux/INIT${ag()}`,REPLACE:`@@redux/REPLACE${ag()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ag()}`},Gw=LP;function RP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function lg(t,e,n){if(typeof t!="function")throw new Error(yn(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(yn(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(yn(1));return n(lg)(t,e)}let o=t,r=e,i=new Map,s=i,a=0,l=!1;function c(){s===i&&(s=new Map,i.forEach((_,b)=>{s.set(b,_)}))}function d(){if(l)throw new Error(yn(3));return r}function u(_){if(typeof _!="function")throw new Error(yn(4));if(l)throw new Error(yn(5));let b=!0;c();let y=a++;return s.set(y,_),function(){if(b){if(l)throw new Error(yn(6));b=!1,c(),s.delete(y),i=null}}}function p(_){if(!RP(_))throw new Error(yn(7));if(typeof _.type>"u")throw new Error(yn(8));if(typeof _.type!="string")throw new Error(yn(17));if(l)throw new Error(yn(9));try{l=!0,r=o(r,_)}finally{l=!1}return(i=s).forEach(y=>{y()}),_}function h(_){if(typeof _!="function")throw new Error(yn(10));o=_,p({type:Gw.REPLACE})}function g(){let _=u;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(yn(11));function y(){let x=b;x.next&&x.next(d())}return y(),{unsubscribe:_(y)}},[Ww](){return this}}}return p({type:Gw.INIT}),{dispatch:p,subscribe:u,getState:d,replaceReducer:h,[Ww]:g}}function Yw(t,e){return function(...n){return e(t.apply(this,n))}}function cg(t,e){if(typeof t=="function")return Yw(t,e);if(typeof t!="object"||t===null)throw new Error(yn(16));let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=Yw(r,e))}return n}function dg(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...o)=>e(n(...o)))}function qw(...t){return e=>(n,o)=>{let r=e(n,o),i=()=>{throw new Error(yn(15))},s={getState:r.getState,dispatch:(l,...c)=>i(l,...c)},a=t.map(l=>l(s));return i=dg(...a)(r.dispatch),{...r,dispatch:i}}}bt();var FF=kh(Qw(),1),KP=CC.startsWith("19"),jP=Symbol.for(KP?"react.transitional.element":"react.element"),VP=Symbol.for("react.portal"),WP=Symbol.for("react.fragment"),GP=Symbol.for("react.strict_mode"),YP=Symbol.for("react.profiler"),qP=Symbol.for("react.consumer"),JP=Symbol.for("react.context"),s0=Symbol.for("react.forward_ref"),XP=Symbol.for("react.suspense"),ZP=Symbol.for("react.suspense_list"),hg=Symbol.for("react.memo"),QP=Symbol.for("react.lazy");var eF=s0,tF=hg;function nF(t){if(typeof t=="object"&&t!==null){let{$$typeof:e}=t;switch(e){case jP:switch(t=t.type,t){case WP:case YP:case GP:case XP:case ZP:return t;default:switch(t=t&&t.$$typeof,t){case JP:case s0:case QP:case hg:return t;case qP:return t;default:return e}}case VP:return e}}}function oF(t){return nF(t)===hg}function rF(t,e,n,o,{areStatesEqual:r,areOwnPropsEqual:i,areStatePropsEqual:s}){let a=!1,l,c,d,u,p;function h(y,v){return l=y,c=v,d=t(l,c),u=e(o,c),p=n(d,u,c),a=!0,p}function g(){return d=t(l,c),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function m(){return t.dependsOnOwnProps&&(d=t(l,c)),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function _(){let y=t(l,c),v=!s(y,d);return d=y,v&&(p=n(d,u,c)),p}function b(y,v){let x=!i(v,c),C=!r(y,l,v,c);return l=y,c=v,x&&C?g():x?m():C?_():p}return function(v,x){return a?b(v,x):h(v,x)}}function iF(t,{initMapStateToProps:e,initMapDispatchToProps:n,initMergeProps:o,...r}){let i=e(t,r),s=n(t,r),a=o(t,r);return rF(i,s,a,t,r)}function sF(t,e){let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=(...i)=>e(r(...i)))}return n}function pg(t){return function(n){let o=t(n);function r(){return o}return r.dependsOnOwnProps=!1,r}}function e0(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function a0(t,e){return function(o,{displayName:r}){let i=function(a,l){return i.dependsOnOwnProps?i.mapToProps(a,l):i.mapToProps(a,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(a,l){i.mapToProps=t,i.dependsOnOwnProps=e0(t);let c=i(a,l);return typeof c=="function"&&(i.mapToProps=c,i.dependsOnOwnProps=e0(c),c=i(a,l)),c},i}}function gg(t,e){return(n,o)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${o.wrappedComponentName}.`)}}function aF(t){return t&&typeof t=="object"?pg(e=>sF(t,e)):t?typeof t=="function"?a0(t,"mapDispatchToProps"):gg(t,"mapDispatchToProps"):pg(e=>({dispatch:e}))}function lF(t){return t?typeof t=="function"?a0(t,"mapStateToProps"):gg(t,"mapStateToProps"):pg(()=>({}))}function cF(t,e,n){return{...n,...t,...e}}function dF(t){return function(n,{displayName:o,areMergedPropsEqual:r}){let i=!1,s;return function(l,c,d){let u=t(l,c,d);return i?r(u,s)||(s=u):(i=!0,s=u),s}}}function uF(t){return t?typeof t=="function"?dF(t):gg(t,"mergeProps"):()=>cF}function pF(t){t()}function fF(){let t=null,e=null;return{clear(){t=null,e=null},notify(){pF(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){let n=[],o=t;for(;o;)n.push(o),o=o.next;return n},subscribe(n){let o=!0,r=e={callback:n,next:null,prev:e};return r.prev?r.prev.next=r:t=r,function(){!o||t===null||(o=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:t=r.next)}}}}var t0={notify(){},get:()=>[]};function l0(t,e){let n,o=t0,r=0,i=!1;function s(m){d();let _=o.subscribe(m),b=!1;return()=>{b||(b=!0,_(),u())}}function a(){o.notify()}function l(){g.onStateChange&&g.onStateChange()}function c(){return i}function d(){r++,n||(n=e?e.addNestedSub(l):t.subscribe(l),o=fF())}function u(){r--,n&&r===0&&(n(),n=void 0,o.clear(),o=t0)}function p(){i||(i=!0,d())}function h(){i&&(i=!1,u())}let g={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>o};return g}var hF=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gF=hF(),mF=()=>typeof navigator<"u"&&navigator.product==="ReactNative",_F=mF(),bF=()=>gF||_F?_n:F,fu=bF();function n0(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function ug(t,e){if(n0(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!n0(t[n[r]],e[n[r]]))return!1;return!0}var yF={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},xF={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},vF={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},c0={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},CF={[eF]:vF,[tF]:c0};function o0(t){return oF(t)?c0:CF[t.$$typeof]||yF}var EF=Object.defineProperty,wF=Object.getOwnPropertyNames,r0=Object.getOwnPropertySymbols,TF=Object.getOwnPropertyDescriptor,SF=Object.getPrototypeOf,i0=Object.prototype;function fg(t,e){if(typeof e!="string"){if(i0){let i=SF(e);i&&i!==i0&&fg(t,i)}let n=wF(e);r0&&(n=n.concat(r0(e)));let o=o0(t),r=o0(e);for(let i=0;i<n.length;++i){let s=n[i];if(!xF[s]&&!(r&&r[s])&&!(o&&o[s])){let a=TF(e,s);try{EF(t,s,a)}catch{}}}}return t}var kF=Symbol.for("react-redux-context"),NF=typeof globalThis<"u"?globalThis:{};function DF(){if(!pt)return{};let t=NF[kF]??=new Map,e=t.get(pt);return e||(e=pt(null),t.set(pt,e)),e}var d0=DF(),OF=[null,null];function IF(t,e,n){fu(()=>t(...e),n)}function AF(t,e,n,o,r,i){t.current=o,n.current=!1,r.current&&(r.current=null,i())}function MF(t,e,n,o,r,i,s,a,l,c,d){if(!t)return()=>{};let u=!1,p=null,h=()=>{if(u||!a.current)return;let m=e.getState(),_,b;try{_=o(m,r.current)}catch(y){b=y,p=y}b||(p=null),_===i.current?s.current||c():(i.current=_,l.current=_,s.current=!0,d())};return n.onStateChange=h,n.trySubscribe(),h(),()=>{if(u=!0,n.tryUnsubscribe(),n.onStateChange=null,p)throw p}}function LF(t,e){return t===e}function RF(t,e,n,{pure:o,areStatesEqual:r=LF,areOwnPropsEqual:i=ug,areStatePropsEqual:s=ug,areMergedPropsEqual:a=ug,forwardRef:l=!1,context:c=d0}={}){let d=c,u=lF(t),p=aF(e),h=uF(n),g=!!t;return _=>{let b=_.displayName||_.name||"Component",y=`Connect(${b})`,v={shouldHandleStateChanges:g,displayName:y,wrappedComponentName:b,WrappedComponent:_,initMapStateToProps:u,initMapDispatchToProps:p,initMergeProps:h,areStatesEqual:r,areStatePropsEqual:s,areOwnPropsEqual:i,areMergedPropsEqual:a};function x(k){let[T,w,S]=X(()=>{let{reactReduxForwardedRef:Be,...nn}=k;return[k.context,Be,nn]},[k]),N=X(()=>{let Be=d;return T?.Consumer,Be},[T,d]),D=ft(N),O=!!k.store&&!!k.store.getState&&!!k.store.dispatch,A=!!D&&!!D.store,I=O?k.store:D.store,R=A?D.getServerState:I.getState,$=X(()=>iF(I.dispatch,v),[I]),[W,P]=X(()=>{if(!g)return OF;let Be=l0(I,O?void 0:D.subscription),nn=Be.notifyNestedSubs.bind(Be);return[Be,nn]},[I,O,D]),q=X(()=>O?D:{...D,subscription:W},[O,D,W]),ce=J(void 0),rt=J(S),Et=J(void 0),_t=J(!1),dt=J(!1),ut=J(void 0);fu(()=>(dt.current=!0,()=>{dt.current=!1}),[]);let re=X(()=>()=>Et.current&&S===rt.current?Et.current:$(I.getState(),S),[I,S]),ee=X(()=>nn=>W?MF(g,I,W,$,rt,ce,_t,dt,Et,P,nn):()=>{},[W]);IF(AF,[rt,ce,_t,S,Et,P]);let be;try{be=yC(ee,re,R?()=>$(R(),S):re)}catch(Be){throw ut.current&&(Be.message+=`
19
+ The error may be correlated with this previous error:
20
+ ${ut.current.stack}
21
+
22
+ `),Be}fu(()=>{ut.current=void 0,Et.current=void 0,ce.current=be});let Fe=X(()=>Ji(_,{...be,ref:w}),[w,_,be]);return X(()=>g?Ji(N.Provider,{value:q},Fe):Fe,[N,Fe,q])}let E=xC(x);if(E.WrappedComponent=_,E.displayName=x.displayName=y,l){let T=Go(function(S,N){return Ji(E,{...S,reactReduxForwardedRef:N})});return T.displayName=y,T.WrappedComponent=_,fg(T,_)}return fg(E,_)}}var mg=RF;function PF(t){let{children:e,context:n,serverState:o,store:r}=t,i=X(()=>{let l=l0(r);return{store:r,subscription:l,getServerState:o?()=>o:void 0}},[r,o]),s=X(()=>r.getState(),[r]);return fu(()=>{let{subscription:l}=i;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),s!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[i,s]),Ji((n||d0).Provider,{value:i},e)}var u0=PF;var BF=!0,_g="Invariant failed";function p0(t,e){if(!t){if(BF)throw new Error(_g);var n=typeof e=="function"?e():e,o=n?"".concat(_g,": ").concat(n):_g;throw new Error(o)}}var mo=function(e){var n=e.top,o=e.right,r=e.bottom,i=e.left,s=o-i,a=r-n,l={top:n,right:o,bottom:r,left:i,width:s,height:a,x:i,y:n,center:{x:(o+i)/2,y:(r+n)/2}};return l},hu=function(e,n){return{top:e.top-n.top,left:e.left-n.left,bottom:e.bottom+n.bottom,right:e.right+n.right}},f0=function(e,n){return{top:e.top+n.top,left:e.left+n.left,bottom:e.bottom-n.bottom,right:e.right-n.right}},$F=function(e,n){return{top:e.top+n.y,left:e.left+n.x,bottom:e.bottom+n.y,right:e.right+n.x}},bg={top:0,right:0,bottom:0,left:0},gu=function(e){var n=e.borderBox,o=e.margin,r=o===void 0?bg:o,i=e.border,s=i===void 0?bg:i,a=e.padding,l=a===void 0?bg:a,c=mo(hu(n,r)),d=mo(f0(n,s)),u=mo(f0(d,l));return{marginBox:c,borderBox:mo(n),paddingBox:d,contentBox:u,margin:r,border:s,padding:l}},go=function(e){var n=e.slice(0,-2),o=e.slice(-2);if(o!=="px")return 0;var r=Number(n);return isNaN(r)&&p0(!1),r},zF=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Hl=function(e,n){var o=e.borderBox,r=e.border,i=e.margin,s=e.padding,a=$F(o,n);return gu({borderBox:a,border:r,margin:i,padding:s})},Ul=function(e,n){return n===void 0&&(n=zF()),Hl(e,n)},yg=function(e,n){var o={top:go(n.marginTop),right:go(n.marginRight),bottom:go(n.marginBottom),left:go(n.marginLeft)},r={top:go(n.paddingTop),right:go(n.paddingRight),bottom:go(n.paddingBottom),left:go(n.paddingLeft)},i={top:go(n.borderTopWidth),right:go(n.borderRightWidth),bottom:go(n.borderBottomWidth),left:go(n.borderLeftWidth)};return gu({borderBox:e,margin:o,padding:r,border:i})},xg=function(e){var n=e.getBoundingClientRect(),o=window.getComputedStyle(e);return yg(n,o)};var HF=function(e){var n=[],o=null,r=function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];n=a,!o&&(o=requestAnimationFrame(function(){o=null,e.apply(void 0,n)}))};return r.cancel=function(){o&&(cancelAnimationFrame(o),o=null)},r},la=HF;var UF=!0,KF=/[ \t]{2,}/g,jF=/^[ \t]*/gm,h0=t=>t.replace(KF," ").replace(jF,"").trim(),VF=t=>h0(`
23
+ %c@hello-pangea/dnd
24
+
25
+ %c${h0(t)}
26
+
27
+ %c\u{1F477}\u200D This is a development only message. It will be removed in production builds.
28
+ `),WF=t=>[VF(t),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"],GF="__@hello-pangea/dnd-disable-dev-warnings";function U0(t,e){UF||typeof window<"u"&&window[GF]||console[t](...WF(e))}var Jq=U0.bind(null,"warn"),YF=U0.bind(null,"error");function ci(){}function qF(t,e){return{...t,...e}}function _o(t,e,n){let o=e.map(r=>{let i=qF(n,r.options);return t.addEventListener(r.eventName,r.fn,i),function(){t.removeEventListener(r.eventName,r.fn,i)}});return function(){o.forEach(i=>{i()})}}var JF=!0,g0="Invariant failed",is=class extends Error{};is.prototype.toString=function(){return this.message};function j(t,e){throw JF?new is(g0):new is(`${g0}: ${e||""}`)}var Ig=class extends nt.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=ci,this.onWindowError=n=>{let o=this.getCallbacks();o.isDragging()&&o.tryAbort(),n.error instanceof is&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=_o(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(e instanceof is){this.setState({});return}throw e}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}},XF=`
29
+ Press space bar to start a drag.
30
+ When dragging you can use the arrow keys to move the item around and escape to cancel.
31
+ Some screen readers may require you to be in focus mode or to use your pass through key
32
+ `,xu=t=>t+1,ZF=t=>`
33
+ You have lifted an item in position ${xu(t.source.index)}
34
+ `,K0=(t,e)=>{let n=t.droppableId===e.droppableId,o=xu(t.index),r=xu(e.index);return n?`
35
+ You have moved the item from position ${o}
36
+ to position ${r}
37
+ `:`
38
+ You have moved the item from position ${o}
39
+ in list ${t.droppableId}
40
+ to list ${e.droppableId}
41
+ in position ${r}
42
+ `},j0=(t,e,n)=>e.droppableId===n.droppableId?`
43
+ The item ${t}
44
+ has been combined with ${n.draggableId}`:`
45
+ The item ${t}
46
+ in list ${e.droppableId}
47
+ has been combined with ${n.draggableId}
48
+ in list ${n.droppableId}
49
+ `,QF=t=>{let e=t.destination;if(e)return K0(t.source,e);let n=t.combine;return n?j0(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},m0=t=>`
50
+ The item has returned to its starting position
51
+ of ${xu(t.index)}
52
+ `,eB=t=>{if(t.reason==="CANCEL")return`
53
+ Movement cancelled.
54
+ ${m0(t.source)}
55
+ `;let e=t.destination,n=t.combine;return e?`
56
+ You have dropped the item.
57
+ ${K0(t.source,e)}
58
+ `:n?`
59
+ You have dropped the item.
60
+ ${j0(t.draggableId,t.source,n)}
61
+ `:`
62
+ The item has been dropped while not over a drop area.
63
+ ${m0(t.source)}
64
+ `},yu={dragHandleUsageInstructions:XF,onDragStart:ZF,onDragUpdate:QF,onDragEnd:eB};function tB(t,e){return!!(t===e||Number.isNaN(t)&&Number.isNaN(e))}function V0(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!tB(t[n],e[n]))return!1;return!0}function Pe(t,e){let n=L(()=>({inputs:e,result:t()}))[0],o=J(!0),r=J(n),s=o.current||!!(e&&r.current.inputs&&V0(e,r.current.inputs))?r.current:{inputs:e,result:t()};return F(()=>{o.current=!1,r.current=s},[s]),s.result}function le(t,e){return Pe(()=>t,e)}var Wt={x:0,y:0},sn=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),Zn=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),di=(t,e)=>t.x===e.x&&t.y===e.y,pa=t=>({x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}),ss=(t,e,n=0)=>t==="x"?{x:e,y:n}:{x:n,y:e},Yl=(t,e)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),_0=(t,e)=>Math.min(...e.map(n=>Yl(t,n))),W0=t=>e=>({x:t(e.x),y:t(e.y)}),nB=(t,e)=>{let n=mo({top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)});return n.width<=0||n.height<=0?null:n},tc=(t,e)=>({top:t.top+e.y,left:t.left+e.x,bottom:t.bottom+e.y,right:t.right+e.x}),b0=t=>[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}],oB={top:0,right:0,bottom:0,left:0},rB=(t,e)=>e?tc(t,e.scroll.diff.displacement):t,iB=(t,e,n)=>n&&n.increasedBy?{...t,[e.end]:t[e.end]+n.increasedBy[e.line]}:t,sB=(t,e)=>e&&e.shouldClipSubject?nB(e.pageMarginBox,t):mo(t),ca=({page:t,withPlaceholder:e,axis:n,frame:o})=>{let r=rB(t.marginBox,o),i=iB(r,n,e),s=sB(i,o);return{page:t,withPlaceholder:e,active:s}},$g=(t,e)=>{t.frame||j();let n=t.frame,o=Zn(e,n.scroll.initial),r=pa(o),i={...n,scroll:{initial:n.scroll.initial,current:e,diff:{value:o,displacement:r},max:n.scroll.max}},s=ca({page:t.subject.page,withPlaceholder:t.subject.withPlaceholder,axis:t.axis,frame:i});return{...t,frame:i,subject:s}};function Vt(t,e=V0){let n=null;function o(...r){if(n&&n.lastThis===this&&e(r,n.lastArgs))return n.lastResult;let i=t.apply(this,r);return n={lastResult:i,lastArgs:r,lastThis:this},i}return o.clear=function(){n=null},o}var G0=Vt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),Y0=Vt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),Eu=Vt(t=>Object.values(t)),aB=Vt(t=>Object.values(t)),fa=Vt((t,e)=>aB(e).filter(o=>t===o.descriptor.droppableId).sort((o,r)=>o.descriptor.index-r.descriptor.index));function zg(t){return t.at&&t.at.type==="REORDER"?t.at.destination:null}function wu(t){return t.at&&t.at.type==="COMBINE"?t.at.combine:null}var Tu=Vt((t,e)=>e.filter(n=>n.descriptor.id!==t.descriptor.id)),lB=({isMovingForward:t,draggable:e,destination:n,insideDestination:o,previousImpact:r})=>{if(!n.isCombineEnabled||!zg(r))return null;function s(h){let g={type:"COMBINE",combine:{draggableId:h,droppableId:n.descriptor.id}};return{...r,at:g}}let a=r.displaced.all,l=a.length?a[0]:null;if(t)return l?s(l):null;let c=Tu(e,o);if(!l){if(!c.length)return null;let h=c[c.length-1];return s(h.descriptor.id)}let d=c.findIndex(h=>h.descriptor.id===l);d===-1&&j();let u=d-1;if(u<0)return null;let p=c[u];return s(p.descriptor.id)},ha=(t,e)=>t.descriptor.droppableId===e.descriptor.id,q0={point:Wt,value:0},ql={invisible:{},visible:{},all:[]},cB={displaced:ql,displacedBy:q0,at:null},bo=(t,e)=>n=>t<=n&&n<=e,J0=t=>{let e=bo(t.top,t.bottom),n=bo(t.left,t.right);return o=>{if(e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right))return!0;let i=e(o.top)||e(o.bottom),s=n(o.left)||n(o.right);if(i&&s)return!0;let l=o.top<t.top&&o.bottom>t.bottom,c=o.left<t.left&&o.right>t.right;return l&&c?!0:l&&s||c&&i}},dB=t=>{let e=bo(t.top,t.bottom),n=bo(t.left,t.right);return o=>e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right)},Hg={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},X0={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},uB=t=>e=>{let n=bo(e.top,e.bottom),o=bo(e.left,e.right);return r=>t===Hg?n(r.top)&&n(r.bottom):o(r.left)&&o(r.right)},pB=(t,e)=>{let n=e.frame?e.frame.scroll.diff.displacement:Wt;return tc(t,n)},fB=(t,e,n)=>e.subject.active?n(e.subject.active)(t):!1,hB=(t,e,n)=>n(e)(t),Ug=({target:t,destination:e,viewport:n,withDroppableDisplacement:o,isVisibleThroughFrameFn:r})=>{let i=o?pB(t,e):t;return fB(i,e,r)&&hB(i,n,r)},gB=t=>Ug({...t,isVisibleThroughFrameFn:J0}),Z0=t=>Ug({...t,isVisibleThroughFrameFn:dB}),mB=t=>Ug({...t,isVisibleThroughFrameFn:uB(t.destination.axis)}),_B=(t,e,n)=>{if(typeof n=="boolean")return n;if(!e)return!0;let{invisible:o,visible:r}=e;if(o[t])return!1;let i=r[t];return i?i.shouldAnimate:!0};function bB(t,e){let n=t.page.marginBox,o={top:e.point.y,right:0,bottom:0,left:e.point.x};return mo(hu(n,o))}function Jl({afterDragging:t,destination:e,displacedBy:n,viewport:o,forceShouldAnimate:r,last:i}){return t.reduce(function(a,l){let c=bB(l,n),d=l.descriptor.id;if(a.all.push(d),!gB({target:c,destination:e,viewport:o,withDroppableDisplacement:!0}))return a.invisible[l.descriptor.id]=!0,a;let p=_B(d,i,r),h={draggableId:d,shouldAnimate:p};return a.visible[d]=h,a},{all:[],visible:{},invisible:{}})}function yB(t,e){if(!t.length)return 0;let n=t[t.length-1].descriptor.index;return e.inHomeList?n:n+1}function y0({insideDestination:t,inHomeList:e,displacedBy:n,destination:o}){let r=yB(t,{inHomeList:e});return{displaced:ql,displacedBy:n,at:{type:"REORDER",destination:{droppableId:o.descriptor.id,index:r}}}}function vu({draggable:t,insideDestination:e,destination:n,viewport:o,displacedBy:r,last:i,index:s,forceShouldAnimate:a}){let l=ha(t,n);if(s==null)return y0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let c=e.find(g=>g.descriptor.index===s);if(!c)return y0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let d=Tu(t,e),u=e.indexOf(c),p=d.slice(u);return{displaced:Jl({afterDragging:p,destination:n,displacedBy:r,last:i,viewport:o.frame,forceShouldAnimate:a}),displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:s}}}}function ui(t,e){return!!e.effected[t]}var xB=({isMovingForward:t,destination:e,draggables:n,combine:o,afterCritical:r})=>{if(!e.isCombineEnabled)return null;let i=o.draggableId,a=n[i].descriptor.index;return ui(i,r)?t?a:a-1:t?a+1:a},vB=({isMovingForward:t,isInHomeList:e,insideDestination:n,location:o})=>{if(!n.length)return null;let r=o.index,i=t?r+1:r-1,s=n[0].descriptor.index,a=n[n.length-1].descriptor.index,l=e?a:a+1;return i<s||i>l?null:i},CB=({isMovingForward:t,isInHomeList:e,draggable:n,draggables:o,destination:r,insideDestination:i,previousImpact:s,viewport:a,afterCritical:l})=>{let c=s.at;if(c||j(),c.type==="REORDER"){let u=vB({isMovingForward:t,isInHomeList:e,location:c.destination,insideDestination:i});return u==null?null:vu({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:u})}let d=xB({isMovingForward:t,destination:r,displaced:s.displaced,draggables:o,combine:c.combine,afterCritical:l});return d==null?null:vu({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:d})},EB=({displaced:t,afterCritical:e,combineWith:n,displacedBy:o})=>{let r=!!(t.visible[n]||t.invisible[n]);return ui(n,e)?r?Wt:pa(o.point):r?o.point:Wt},wB=({afterCritical:t,impact:e,draggables:n})=>{let o=wu(e);o||j();let r=o.draggableId,i=n[r].page.borderBox.center,s=EB({displaced:e.displaced,afterCritical:t,combineWith:r,displacedBy:e.displacedBy});return sn(i,s)},Q0=(t,e)=>e.margin[t.start]+e.borderBox[t.size]/2,TB=(t,e)=>e.margin[t.end]+e.borderBox[t.size]/2,Kg=(t,e,n)=>e[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2,x0=({axis:t,moveRelativeTo:e,isMoving:n})=>ss(t.line,e.marginBox[t.end]+Q0(t,n),Kg(t,e.marginBox,n)),v0=({axis:t,moveRelativeTo:e,isMoving:n})=>ss(t.line,e.marginBox[t.start]-TB(t,n),Kg(t,e.marginBox,n)),SB=({axis:t,moveInto:e,isMoving:n})=>ss(t.line,e.contentBox[t.start]+Q0(t,n),Kg(t,e.contentBox,n)),kB=({impact:t,draggable:e,draggables:n,droppable:o,afterCritical:r})=>{let i=fa(o.descriptor.id,n),s=e.page,a=o.axis;if(!i.length)return SB({axis:a,moveInto:o.page,isMoving:s});let{displaced:l,displacedBy:c}=t,d=l.all[0];if(d){let p=n[d];if(ui(d,r))return v0({axis:a,moveRelativeTo:p.page,isMoving:s});let h=Hl(p.page,c.point);return v0({axis:a,moveRelativeTo:h,isMoving:s})}let u=i[i.length-1];if(u.descriptor.id===e.descriptor.id)return s.borderBox.center;if(ui(u.descriptor.id,r)){let p=Hl(u.page,pa(r.displacedBy.point));return x0({axis:a,moveRelativeTo:p,isMoving:s})}return x0({axis:a,moveRelativeTo:u.page,isMoving:s})},Ag=(t,e)=>{let n=t.frame;return n?sn(e,n.scroll.diff.displacement):e},NB=({impact:t,draggable:e,droppable:n,draggables:o,afterCritical:r})=>{let i=e.page.borderBox.center,s=t.at;return!n||!s?i:s.type==="REORDER"?kB({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:r}):wB({impact:t,draggables:o,afterCritical:r})},Su=t=>{let e=NB(t),n=t.droppable;return n?Ag(n,e):e},eT=(t,e)=>{let n=Zn(e,t.scroll.initial),o=pa(n);return{frame:mo({top:e.y,bottom:e.y+t.frame.height,left:e.x,right:e.x+t.frame.width}),scroll:{initial:t.scroll.initial,max:t.scroll.max,current:e,diff:{value:n,displacement:o}}}};function C0(t,e){return t.map(n=>e[n])}function DB(t,e){for(let n=0;n<e.length;n++){let o=e[n].visible[t];if(o)return o}return null}var OB=({impact:t,viewport:e,destination:n,draggables:o,maxScrollChange:r})=>{let i=eT(e,sn(e.scroll.current,r)),s=n.frame?$g(n,sn(n.frame.scroll.current,r)):n,a=t.displaced,l=Jl({afterDragging:C0(a.all,o),destination:n,displacedBy:t.displacedBy,viewport:i.frame,last:a,forceShouldAnimate:!1}),c=Jl({afterDragging:C0(a.all,o),destination:s,displacedBy:t.displacedBy,viewport:e.frame,last:a,forceShouldAnimate:!1}),d={},u={},p=[a,l,c];return a.all.forEach(g=>{let m=DB(g,p);if(m){u[g]=m;return}d[g]=!0}),{...t,displaced:{all:a.all,invisible:d,visible:u}}},IB=(t,e)=>sn(t.scroll.diff.displacement,e),jg=({pageBorderBoxCenter:t,draggable:e,viewport:n})=>{let o=IB(n,t),r=Zn(o,e.page.borderBox.center);return sn(e.client.borderBox.center,r)},tT=({draggable:t,destination:e,newPageBorderBoxCenter:n,viewport:o,withDroppableDisplacement:r,onlyOnMainAxis:i=!1})=>{let s=Zn(n,t.page.borderBox.center),l={target:tc(t.page.borderBox,s),destination:e,withDroppableDisplacement:r,viewport:o};return i?mB(l):Z0(l)},AB=({isMovingForward:t,draggable:e,destination:n,draggables:o,previousImpact:r,viewport:i,previousPageBorderBoxCenter:s,previousClientSelection:a,afterCritical:l})=>{if(!n.isEnabled)return null;let c=fa(n.descriptor.id,o),d=ha(e,n),u=lB({isMovingForward:t,draggable:e,destination:n,insideDestination:c,previousImpact:r})||CB({isMovingForward:t,isInHomeList:d,draggable:e,draggables:o,destination:n,insideDestination:c,previousImpact:r,viewport:i,afterCritical:l});if(!u)return null;let p=Su({impact:u,draggable:e,droppable:n,draggables:o,afterCritical:l});if(tT({draggable:e,destination:n,newPageBorderBoxCenter:p,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:jg({pageBorderBoxCenter:p,draggable:e,viewport:i}),impact:u,scrollJumpRequest:null};let g=Zn(p,s),m=OB({impact:u,viewport:i,destination:n,draggables:o,maxScrollChange:g});return{clientSelection:a,impact:m,scrollJumpRequest:g}},xn=t=>{let e=t.subject.active;return e||j(),e},MB=({isMovingForward:t,pageBorderBoxCenter:e,source:n,droppables:o,viewport:r})=>{let i=n.subject.active;if(!i)return null;let s=n.axis,a=bo(i[s.start],i[s.end]),l=Eu(o).filter(d=>d!==n).filter(d=>d.isEnabled).filter(d=>!!d.subject.active).filter(d=>J0(r.frame)(xn(d))).filter(d=>{let u=xn(d);return t?i[s.crossAxisEnd]<u[s.crossAxisEnd]:u[s.crossAxisStart]<i[s.crossAxisStart]}).filter(d=>{let u=xn(d),p=bo(u[s.start],u[s.end]);return a(u[s.start])||a(u[s.end])||p(i[s.start])||p(i[s.end])}).sort((d,u)=>{let p=xn(d)[s.crossAxisStart],h=xn(u)[s.crossAxisStart];return t?p-h:h-p}).filter((d,u,p)=>xn(d)[s.crossAxisStart]===xn(p[0])[s.crossAxisStart]);if(!l.length)return null;if(l.length===1)return l[0];let c=l.filter(d=>bo(xn(d)[s.start],xn(d)[s.end])(e[s.line]));return c.length===1?c[0]:c.length>1?c.sort((d,u)=>xn(d)[s.start]-xn(u)[s.start])[0]:l.sort((d,u)=>{let p=_0(e,b0(xn(d))),h=_0(e,b0(xn(u)));return p!==h?p-h:xn(d)[s.start]-xn(u)[s.start]})[0]},E0=(t,e)=>{let n=t.page.borderBox.center;return ui(t.descriptor.id,e)?Zn(n,e.displacedBy.point):n},LB=(t,e)=>{let n=t.page.borderBox;return ui(t.descriptor.id,e)?tc(n,pa(e.displacedBy.point)):n},RB=({pageBorderBoxCenter:t,viewport:e,destination:n,insideDestination:o,afterCritical:r})=>o.filter(s=>Z0({target:LB(s,r),destination:n,viewport:e.frame,withDroppableDisplacement:!0})).sort((s,a)=>{let l=Yl(t,Ag(n,E0(s,r))),c=Yl(t,Ag(n,E0(a,r)));return l<c?-1:c<l?1:s.descriptor.index-a.descriptor.index})[0]||null,nc=Vt(function(e,n){let o=n[e.line];return{value:o,point:ss(e.line,o)}}),PB=(t,e,n)=>{let o=t.axis;if(t.descriptor.mode==="virtual")return ss(o.line,e[o.line]);let r=t.subject.page.contentBox[o.size],l=fa(t.descriptor.id,n).reduce((c,d)=>c+d.client.marginBox[o.size],0)+e[o.line]-r;return l<=0?null:ss(o.line,l)},nT=(t,e)=>({...t,scroll:{...t.scroll,max:e}}),oT=(t,e,n)=>{let o=t.frame;ha(e,t)&&j(),t.subject.withPlaceholder&&j();let r=nc(t.axis,e.displaceBy).point,i=PB(t,r,n),s={placeholderSize:r,increasedBy:i,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!o){let d=ca({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:t.frame});return{...t,subject:d}}let a=i?sn(o.scroll.max,i):o.scroll.max,l=nT(o,a),c=ca({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:l});return{...t,subject:c,frame:l}},FB=t=>{let e=t.subject.withPlaceholder;e||j();let n=t.frame;if(!n){let s=ca({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return{...t,subject:s}}let o=e.oldFrameMaxScroll;o||j();let r=nT(n,o),i=ca({page:t.subject.page,axis:t.axis,frame:r,withPlaceholder:null});return{...t,subject:i,frame:r}},BB=({previousPageBorderBoxCenter:t,moveRelativeTo:e,insideDestination:n,draggable:o,draggables:r,destination:i,viewport:s,afterCritical:a})=>{if(!e){if(n.length)return null;let u={displaced:ql,displacedBy:q0,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},p=Su({impact:u,draggable:o,droppable:i,draggables:r,afterCritical:a}),h=ha(o,i)?i:oT(i,o,r);return tT({draggable:o,destination:h,newPageBorderBoxCenter:p,viewport:s.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?u:null}let l=t[i.axis.line]<=e.page.borderBox.center[i.axis.line],c=(()=>{let u=e.descriptor.index;return e.descriptor.id===o.descriptor.id||l?u:u+1})(),d=nc(i.axis,o.displaceBy);return vu({draggable:o,insideDestination:n,destination:i,viewport:s,displacedBy:d,last:ql,index:c})},$B=({isMovingForward:t,previousPageBorderBoxCenter:e,draggable:n,isOver:o,draggables:r,droppables:i,viewport:s,afterCritical:a})=>{let l=MB({isMovingForward:t,pageBorderBoxCenter:e,source:o,droppables:i,viewport:s});if(!l)return null;let c=fa(l.descriptor.id,r),d=RB({pageBorderBoxCenter:e,viewport:s,destination:l,insideDestination:c,afterCritical:a}),u=BB({previousPageBorderBoxCenter:e,destination:l,draggable:n,draggables:r,moveRelativeTo:d,insideDestination:c,viewport:s,afterCritical:a});if(!u)return null;let p=Su({impact:u,draggable:n,droppable:l,draggables:r,afterCritical:a});return{clientSelection:jg({pageBorderBoxCenter:p,draggable:n,viewport:s}),impact:u,scrollJumpRequest:null}},Qn=t=>{let e=t.at;return e?e.type==="REORDER"?e.destination.droppableId:e.combine.droppableId:null},zB=(t,e)=>{let n=Qn(t);return n?e[n]:null},HB=({state:t,type:e})=>{let n=zB(t.impact,t.dimensions.droppables),o=!!n,r=t.dimensions.droppables[t.critical.droppable.id],i=n||r,s=i.axis.direction,a=s==="vertical"&&(e==="MOVE_UP"||e==="MOVE_DOWN")||s==="horizontal"&&(e==="MOVE_LEFT"||e==="MOVE_RIGHT");if(a&&!o)return null;let l=e==="MOVE_DOWN"||e==="MOVE_RIGHT",c=t.dimensions.draggables[t.critical.draggable.id],d=t.current.page.borderBoxCenter,{draggables:u,droppables:p}=t.dimensions;return a?AB({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:u,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):$B({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:u,droppables:p,viewport:t.viewport,afterCritical:t.afterCritical})};function rs(t){return t.phase==="DRAGGING"||t.phase==="COLLECTING"}function rT(t){let e=bo(t.top,t.bottom),n=bo(t.left,t.right);return function(r){return e(r.y)&&n(r.x)}}function UB(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function KB({pageBorderBox:t,draggable:e,candidates:n}){let o=e.page.borderBox.center,r=n.map(i=>{let s=i.axis,a=ss(i.axis.line,t.center[s.line],i.page.borderBox.center[s.crossAxisLine]);return{id:i.descriptor.id,distance:Yl(o,a)}}).sort((i,s)=>s.distance-i.distance);return r[0]?r[0].id:null}function jB({pageBorderBox:t,draggable:e,droppables:n}){let o=Eu(n).filter(r=>{if(!r.isEnabled)return!1;let i=r.subject.active;if(!i||!UB(t,i))return!1;if(rT(i)(t.center))return!0;let s=r.axis,a=i.center[s.crossAxisLine],l=t[s.crossAxisStart],c=t[s.crossAxisEnd],d=bo(i[s.crossAxisStart],i[s.crossAxisEnd]),u=d(l),p=d(c);return!u&&!p?!0:u?l<a:c>a});return o.length?o.length===1?o[0].descriptor.id:KB({pageBorderBox:t,draggable:e,candidates:o}):null}var iT=(t,e)=>mo(tc(t,e)),VB=(t,e)=>{let n=t.frame;return n?iT(e,n.scroll.diff.value):e};function sT({displaced:t,id:e}){return!!(t.visible[e]||t.invisible[e])}function WB({draggable:t,closest:e,inHomeList:n}){return e?n&&e.descriptor.index>t.descriptor.index?e.descriptor.index-1:e.descriptor.index:null}var GB=({pageBorderBoxWithDroppableScroll:t,draggable:e,destination:n,insideDestination:o,last:r,viewport:i,afterCritical:s})=>{let a=n.axis,l=nc(n.axis,e.displaceBy),c=l.value,d=t[a.start],u=t[a.end],h=Tu(e,o).find(m=>{let _=m.descriptor.id,b=m.page.borderBox.center[a.line],y=ui(_,s),v=sT({displaced:r,id:_});return y?v?u<=b:d<b-c:v?u<=b+c:d<b})||null,g=WB({draggable:e,closest:h,inHomeList:ha(e,n)});return vu({draggable:e,insideDestination:o,destination:n,viewport:i,last:r,displacedBy:l,index:g})},YB=4,qB=({draggable:t,pageBorderBoxWithDroppableScroll:e,previousImpact:n,destination:o,insideDestination:r,afterCritical:i})=>{if(!o.isCombineEnabled)return null;let s=o.axis,a=nc(o.axis,t.displaceBy),l=a.value,c=e[s.start],d=e[s.end],p=Tu(t,r).find(g=>{let m=g.descriptor.id,_=g.page.borderBox,y=_[s.size]/YB,v=ui(m,i),x=sT({displaced:n.displaced,id:m});return v?x?d>_[s.start]+y&&d<_[s.end]-y:c>_[s.start]-l+y&&c<_[s.end]-l-y:x?d>_[s.start]+l+y&&d<_[s.end]+l-y:c>_[s.start]+y&&c<_[s.end]-y});return p?{displacedBy:a,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:o.descriptor.id}}}:null},aT=({pageOffset:t,draggable:e,draggables:n,droppables:o,previousImpact:r,viewport:i,afterCritical:s})=>{let a=iT(e.page.borderBox,t),l=jB({pageBorderBox:a,draggable:e,droppables:o});if(!l)return cB;let c=o[l],d=fa(c.descriptor.id,n),u=VB(c,a);return qB({pageBorderBoxWithDroppableScroll:u,draggable:e,previousImpact:r,destination:c,insideDestination:d,afterCritical:s})||GB({pageBorderBoxWithDroppableScroll:u,draggable:e,destination:c,insideDestination:d,last:r.displaced,viewport:i,afterCritical:s})},Vg=(t,e)=>({...t,[e.descriptor.id]:e}),JB=({previousImpact:t,impact:e,droppables:n})=>{let o=Qn(t),r=Qn(e);if(!o||o===r)return n;let i=n[o];if(!i.subject.withPlaceholder)return n;let s=FB(i);return Vg(n,s)},XB=({draggable:t,draggables:e,droppables:n,previousImpact:o,impact:r})=>{let i=JB({previousImpact:o,impact:r,droppables:n}),s=Qn(r);if(!s)return i;let a=n[s];if(ha(t,a)||a.subject.withPlaceholder)return i;let l=oT(a,t,e);return Vg(i,l)},Wl=({state:t,clientSelection:e,dimensions:n,viewport:o,impact:r,scrollJumpRequest:i})=>{let s=o||t.viewport,a=n||t.dimensions,l=e||t.current.client.selection,c=Zn(l,t.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:sn(t.initial.client.borderBoxCenter,c)},u={selection:sn(d.selection,s.scroll.current),borderBoxCenter:sn(d.borderBoxCenter,s.scroll.current),offset:sn(d.offset,s.scroll.diff.value)},p={client:d,page:u};if(t.phase==="COLLECTING")return{...t,dimensions:a,viewport:s,current:p};let h=a.draggables[t.critical.draggable.id],g=r||aT({pageOffset:u.offset,draggable:h,draggables:a.draggables,droppables:a.droppables,previousImpact:t.impact,viewport:s,afterCritical:t.afterCritical}),m=XB({draggable:h,impact:g,previousImpact:t.impact,draggables:a.draggables,droppables:a.droppables});return{...t,current:p,dimensions:{draggables:a.draggables,droppables:m},impact:g,viewport:s,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function ZB(t,e){return t.map(n=>e[n])}var lT=({impact:t,viewport:e,draggables:n,destination:o,forceShouldAnimate:r})=>{let i=t.displaced,s=ZB(i.all,n),a=Jl({afterDragging:s,destination:o,displacedBy:t.displacedBy,viewport:e.frame,forceShouldAnimate:r,last:i});return{...t,displaced:a}},cT=({impact:t,draggable:e,droppable:n,draggables:o,viewport:r,afterCritical:i})=>{let s=Su({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:i});return jg({pageBorderBoxCenter:s,draggable:e,viewport:r})},dT=({state:t,dimensions:e,viewport:n})=>{t.movementMode!=="SNAP"&&j();let o=t.impact,r=n||t.viewport,i=e||t.dimensions,{draggables:s,droppables:a}=i,l=s[t.critical.draggable.id],c=Qn(o);c||j();let d=a[c],u=lT({impact:o,viewport:r,destination:d,draggables:s}),p=cT({impact:u,draggable:l,droppable:d,draggables:s,viewport:r,afterCritical:t.afterCritical});return Wl({impact:u,clientSelection:p,state:t,dimensions:i,viewport:r})},QB=t=>({index:t.index,droppableId:t.droppableId}),uT=({draggable:t,home:e,draggables:n,viewport:o})=>{let r=nc(e.axis,t.displaceBy),i=fa(e.descriptor.id,n),s=i.indexOf(t);s===-1&&j();let a=i.slice(s+1),l=a.reduce((p,h)=>(p[h.descriptor.id]=!0,p),{}),c={inVirtualList:e.descriptor.mode==="virtual",displacedBy:r,effected:l};return{impact:{displaced:Jl({afterDragging:a,destination:e,displacedBy:r,last:null,viewport:o.frame,forceShouldAnimate:!1}),displacedBy:r,at:{type:"REORDER",destination:QB(t.descriptor)}},afterCritical:c}},e2=(t,e)=>({draggables:t.draggables,droppables:Vg(t.droppables,e)}),oc=t=>{},rc=t=>{},t2=({draggable:t,offset:e,initialWindowScroll:n})=>{let o=Hl(t.client,e),r=Ul(o,n);return{...t,placeholder:{...t.placeholder,client:o},client:o,page:r}},n2=t=>{let e=t.frame;return e||j(),e},o2=({additions:t,updatedDroppables:e,viewport:n})=>{let o=n.scroll.diff.value;return t.map(r=>{let i=r.descriptor.droppableId,s=e[i],l=n2(s).scroll.diff.value,c=sn(o,l);return t2({draggable:r,offset:c,initialWindowScroll:n.scroll.initial})})},r2=({state:t,published:e})=>{oc();let n=e.modified.map(b=>{let y=t.dimensions.droppables[b.droppableId];return $g(y,b.scroll)}),o={...t.dimensions.droppables,...G0(n)},r=Y0(o2({additions:e.additions,updatedDroppables:o,viewport:t.viewport})),i={...t.dimensions.draggables,...r};e.removals.forEach(b=>{delete i[b]});let s={droppables:o,draggables:i},a=Qn(t.impact),l=a?s.droppables[a]:null,c=s.draggables[t.critical.draggable.id],d=s.droppables[t.critical.droppable.id],{impact:u,afterCritical:p}=uT({draggable:c,home:d,draggables:i,viewport:t.viewport}),h=l&&l.isCombineEnabled?t.impact:u,g=aT({pageOffset:t.current.page.offset,draggable:s.draggables[t.critical.draggable.id],draggables:s.draggables,droppables:s.droppables,previousImpact:h,viewport:t.viewport,afterCritical:p});rc();let m={...t,phase:"DRAGGING",impact:g,onLiftImpact:u,dimensions:s,afterCritical:p,forceShouldAnimate:!1};return t.phase==="COLLECTING"?m:{...m,phase:"DROP_PENDING",reason:t.reason,isWaiting:!1}},Mg=t=>t.movementMode==="SNAP",vg=(t,e,n)=>{let o=e2(t.dimensions,e);return!Mg(t)||n?Wl({state:t,dimensions:o}):dT({state:t,dimensions:o})};function Cg(t){return t.isDragging&&t.movementMode==="SNAP"?{...t,scrollJumpRequest:null}:t}var w0={phase:"IDLE",completed:null,shouldFlush:!1},i2=(t=w0,e)=>{if(e.type==="FLUSH")return{...w0,shouldFlush:!0};if(e.type==="INITIAL_PUBLISH"){t.phase!=="IDLE"&&j();let{critical:n,clientSelection:o,viewport:r,dimensions:i,movementMode:s}=e.payload,a=i.draggables[n.draggable.id],l=i.droppables[n.droppable.id],c={selection:o,borderBoxCenter:a.client.borderBox.center,offset:Wt},d={client:c,page:{selection:sn(c.selection,r.scroll.initial),borderBoxCenter:sn(c.selection,r.scroll.initial),offset:sn(c.selection,r.scroll.diff.value)}},u=Eu(i.droppables).every(m=>!m.isFixedOnPage),{impact:p,afterCritical:h}=uT({draggable:a,home:l,draggables:i.draggables,viewport:r});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:s,dimensions:i,initial:d,current:d,isWindowScrollAllowed:u,impact:p,afterCritical:h,onLiftImpact:p,viewport:r,scrollJumpRequest:null,forceShouldAnimate:null}}if(e.type==="COLLECTION_STARTING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"?t:(t.phase!=="DRAGGING"&&j(),{...t,phase:"COLLECTING"});if(e.type==="PUBLISH_WHILE_DRAGGING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"||j(),r2({state:t,published:e.payload});if(e.type==="MOVE"){if(t.phase==="DROP_PENDING")return t;rs(t)||j();let{client:n}=e.payload;return di(n,t.current.client.selection)?t:Wl({state:t,clientSelection:n,impact:Mg(t)?t.impact:null})}if(e.type==="UPDATE_DROPPABLE_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="COLLECTING")return Cg(t);rs(t)||j();let{id:n,newScroll:o}=e.payload,r=t.dimensions.droppables[n];if(!r)return t;let i=$g(r,o);return vg(t,i,!1)}if(e.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(t.phase==="DROP_PENDING")return t;rs(t)||j();let{id:n,isEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isEnabled===o&&j();let i={...r,isEnabled:o};return vg(t,i,!0)}if(e.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(t.phase==="DROP_PENDING")return t;rs(t)||j();let{id:n,isCombineEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isCombineEnabled===o&&j();let i={...r,isCombineEnabled:o};return vg(t,i,!0)}if(e.type==="MOVE_BY_WINDOW_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="DROP_ANIMATING")return t;rs(t)||j(),t.isWindowScrollAllowed||j();let n=e.payload.newScroll;if(di(t.viewport.scroll.current,n))return Cg(t);let o=eT(t.viewport,n);return Mg(t)?dT({state:t,viewport:o}):Wl({state:t,viewport:o})}if(e.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!rs(t))return t;let n=e.payload.maxScroll;if(di(n,t.viewport.scroll.max))return t;let o={...t.viewport,scroll:{...t.viewport.scroll,max:n}};return{...t,viewport:o}}if(e.type==="MOVE_UP"||e.type==="MOVE_DOWN"||e.type==="MOVE_LEFT"||e.type==="MOVE_RIGHT"){if(t.phase==="COLLECTING"||t.phase==="DROP_PENDING")return t;t.phase!=="DRAGGING"&&j();let n=HB({state:t,type:e.type});return n?Wl({state:t,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):t}if(e.type==="DROP_PENDING"){let n=e.payload.reason;return t.phase!=="COLLECTING"&&j(),{...t,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(e.type==="DROP_ANIMATE"){let{completed:n,dropDuration:o,newHomeClientOffset:r}=e.payload;return t.phase==="DRAGGING"||t.phase==="DROP_PENDING"||j(),{phase:"DROP_ANIMATING",completed:n,dropDuration:o,newHomeClientOffset:r,dimensions:t.dimensions}}if(e.type==="DROP_COMPLETE"){let{completed:n}=e.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return t};function Ve(t,e){return t instanceof Object&&"type"in t&&t.type===e}var s2=t=>({type:"BEFORE_INITIAL_CAPTURE",payload:t}),a2=t=>({type:"LIFT",payload:t}),l2=t=>({type:"INITIAL_PUBLISH",payload:t}),c2=t=>({type:"PUBLISH_WHILE_DRAGGING",payload:t}),d2=()=>({type:"COLLECTION_STARTING",payload:null}),u2=t=>({type:"UPDATE_DROPPABLE_SCROLL",payload:t}),p2=t=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}),f2=t=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}),pT=t=>({type:"MOVE",payload:t}),h2=t=>({type:"MOVE_BY_WINDOW_SCROLL",payload:t}),g2=t=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}),m2=()=>({type:"MOVE_UP",payload:null}),_2=()=>({type:"MOVE_DOWN",payload:null}),b2=()=>({type:"MOVE_RIGHT",payload:null}),y2=()=>({type:"MOVE_LEFT",payload:null}),Wg=()=>({type:"FLUSH",payload:null}),x2=t=>({type:"DROP_ANIMATE",payload:t}),Gg=t=>({type:"DROP_COMPLETE",payload:t}),fT=t=>({type:"DROP",payload:t}),v2=t=>({type:"DROP_PENDING",payload:t}),hT=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var C2=t=>({getState:e,dispatch:n})=>o=>r=>{if(!Ve(r,"LIFT")){o(r);return}let{id:i,clientSelection:s,movementMode:a}=r.payload,l=e();l.phase==="DROP_ANIMATING"&&n(Gg({completed:l.completed})),e().phase!=="IDLE"&&j(),n(Wg()),n(s2({draggableId:i,movementMode:a}));let d={draggableId:i,scrollOptions:{shouldPublishImmediately:a==="SNAP"}},{critical:u,dimensions:p,viewport:h}=t.startPublishing(d);n(l2({critical:u,dimensions:p,clientSelection:s,movementMode:a,viewport:h}))},E2=t=>()=>e=>n=>{Ve(n,"INITIAL_PUBLISH")&&t.dragging(),Ve(n,"DROP_ANIMATE")&&t.dropping(n.payload.completed.result.reason),(Ve(n,"FLUSH")||Ve(n,"DROP_COMPLETE"))&&t.resting(),e(n)},Yg={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Xl={opacity:{drop:0,combining:.7},scale:{drop:.75}},gT={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},os=`${gT.outOfTheWay}s ${Yg.outOfTheWay}`,Gl={fluid:`opacity ${os}`,snap:`transform ${os}, opacity ${os}`,drop:t=>{let e=`${t}s ${Yg.drop}`;return`transform ${e}, opacity ${e}`},outOfTheWay:`transform ${os}`,placeholder:`height ${os}, width ${os}, margin ${os}`},T0=t=>di(t,Wt)?void 0:`translate(${t.x}px, ${t.y}px)`,Lg={moveTo:T0,drop:(t,e)=>{let n=T0(t);if(n)return e?`${n} scale(${Xl.scale.drop})`:n}},{minDropTime:Rg,maxDropTime:mT}=gT,w2=mT-Rg,S0=1500,T2=.6,S2=({current:t,destination:e,reason:n})=>{let o=Yl(t,e);if(o<=0)return Rg;if(o>=S0)return mT;let r=o/S0,i=Rg+w2*r,s=n==="CANCEL"?i*T2:i;return Number(s.toFixed(2))},k2=({impact:t,draggable:e,dimensions:n,viewport:o,afterCritical:r})=>{let{draggables:i,droppables:s}=n,a=Qn(t),l=a?s[a]:null,c=s[e.descriptor.droppableId],d=cT({impact:t,draggable:e,draggables:i,afterCritical:r,droppable:l||c,viewport:o});return Zn(d,e.client.borderBox.center)},N2=({draggables:t,reason:e,lastImpact:n,home:o,viewport:r,onLiftImpact:i})=>!n.at||e!=="DROP"?{impact:lT({draggables:t,impact:i,destination:o,viewport:r,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:ql},didDropInsideDroppable:!0},D2=({getState:t,dispatch:e})=>n=>o=>{if(!Ve(o,"DROP")){n(o);return}let r=t(),i=o.payload.reason;if(r.phase==="COLLECTING"){e(v2({reason:i}));return}if(r.phase==="IDLE")return;r.phase==="DROP_PENDING"&&r.isWaiting&&j(),r.phase==="DRAGGING"||r.phase==="DROP_PENDING"||j();let a=r.critical,l=r.dimensions,c=l.draggables[r.critical.draggable.id],{impact:d,didDropInsideDroppable:u}=N2({reason:i,lastImpact:r.impact,afterCritical:r.afterCritical,onLiftImpact:r.onLiftImpact,home:r.dimensions.droppables[r.critical.droppable.id],viewport:r.viewport,draggables:r.dimensions.draggables}),p=u?zg(d):null,h=u?wu(d):null,g={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:c.descriptor.id,type:c.descriptor.type,source:g,reason:i,mode:r.movementMode,destination:p,combine:h},_=k2({impact:d,draggable:c,dimensions:l,viewport:r.viewport,afterCritical:r.afterCritical}),b={critical:r.critical,afterCritical:r.afterCritical,result:m,impact:d};if(!(!di(r.current.client.offset,_)||!!m.combine)){e(Gg({completed:b}));return}let v=S2({current:r.current.client.offset,destination:_,reason:i});e(x2({newHomeClientOffset:_,dropDuration:v,completed:b}))},_T=()=>({x:window.pageXOffset,y:window.pageYOffset});function O2(t){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:e=>{e.target!==window&&e.target!==window.document||t()}}}function I2({onWindowScroll:t}){function e(){t(_T())}let n=la(e),o=O2(n),r=ci;function i(){return r!==ci}function s(){i()&&j(),r=_o(window,[o])}function a(){i()||j(),n.cancel(),r(),r=ci}return{start:s,stop:a,isActive:i}}var A2=t=>Ve(t,"DROP_COMPLETE")||Ve(t,"DROP_ANIMATE")||Ve(t,"FLUSH"),M2=t=>{let e=I2({onWindowScroll:n=>{t.dispatch(h2({newScroll:n}))}});return n=>o=>{!e.isActive()&&Ve(o,"INITIAL_PUBLISH")&&e.start(),e.isActive()&&A2(o)&&e.stop(),n(o)}},L2=t=>{let e=!1,n=!1,o=setTimeout(()=>{n=!0}),r=i=>{e||n||(e=!0,t(i),clearTimeout(o))};return r.wasCalled=()=>e,r},R2=()=>{let t=[],e=r=>{let i=t.findIndex(a=>a.timerId===r);i===-1&&j();let[s]=t.splice(i,1);s.callback()};return{add:r=>{let i=setTimeout(()=>e(i)),s={timerId:i,callback:r};t.push(s)},flush:()=>{if(!t.length)return;let r=[...t];t.length=0,r.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}},P2=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.droppableId===e.droppableId&&t.index===e.index,F2=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.draggableId===e.draggableId&&t.droppableId===e.droppableId,B2=(t,e)=>{if(t===e)return!0;let n=t.draggable.id===e.draggable.id&&t.draggable.droppableId===e.draggable.droppableId&&t.draggable.type===e.draggable.type&&t.draggable.index===e.draggable.index,o=t.droppable.id===e.droppable.id&&t.droppable.type===e.droppable.type;return n&&o},Kl=(t,e)=>{oc(),e(),rc()},mu=(t,e)=>({draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:e});function Eg(t,e,n,o){if(!t){n(o(e));return}let r=L2(n);t(e,{announce:r}),r.wasCalled()||n(o(e))}var $2=(t,e)=>{let n=R2(),o=null,r=(u,p)=>{o&&j(),Kl("onBeforeCapture",()=>{let h=t().onBeforeCapture;h&&h({draggableId:u,mode:p})})},i=(u,p)=>{o&&j(),Kl("onBeforeDragStart",()=>{let h=t().onBeforeDragStart;h&&h(mu(u,p))})},s=(u,p)=>{o&&j();let h=mu(u,p);o={mode:p,lastCritical:u,lastLocation:h.source,lastCombine:null},n.add(()=>{Kl("onDragStart",()=>Eg(t().onDragStart,h,e,yu.onDragStart))})},a=(u,p)=>{let h=zg(p),g=wu(p);o||j();let m=!B2(u,o.lastCritical);m&&(o.lastCritical=u);let _=!P2(o.lastLocation,h);_&&(o.lastLocation=h);let b=!F2(o.lastCombine,g);if(b&&(o.lastCombine=g),!m&&!_&&!b)return;let y={...mu(u,o.mode),combine:g,destination:h};n.add(()=>{Kl("onDragUpdate",()=>Eg(t().onDragUpdate,y,e,yu.onDragUpdate))})},l=()=>{o||j(),n.flush()},c=u=>{o||j(),o=null,Kl("onDragEnd",()=>Eg(t().onDragEnd,u,e,yu.onDragEnd))};return{beforeCapture:r,beforeStart:i,start:s,update:a,flush:l,drop:c,abort:()=>{if(!o)return;let u={...mu(o.lastCritical,o.mode),combine:null,destination:null,reason:"CANCEL"};c(u)}}},z2=(t,e)=>{let n=$2(t,e);return o=>r=>i=>{if(Ve(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Ve(i,"INITIAL_PUBLISH")){let a=i.payload.critical;n.beforeStart(a,i.payload.movementMode),r(i),n.start(a,i.payload.movementMode);return}if(Ve(i,"DROP_COMPLETE")){let a=i.payload.completed.result;n.flush(),r(i),n.drop(a);return}if(r(i),Ve(i,"FLUSH")){n.abort();return}let s=o.getState();s.phase==="DRAGGING"&&n.update(s.critical,s.impact)}},H2=t=>e=>n=>{if(!Ve(n,"DROP_ANIMATION_FINISHED")){e(n);return}let o=t.getState();o.phase!=="DROP_ANIMATING"&&j(),t.dispatch(Gg({completed:o.completed}))},U2=t=>{let e=null,n=null;function o(){n&&(cancelAnimationFrame(n),n=null),e&&(e(),e=null)}return r=>i=>{if((Ve(i,"FLUSH")||Ve(i,"DROP_COMPLETE")||Ve(i,"DROP_ANIMATION_FINISHED"))&&o(),r(i),!Ve(i,"DROP_ANIMATE"))return;let s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){t.getState().phase==="DROP_ANIMATING"&&t.dispatch(hT())}};n=requestAnimationFrame(()=>{n=null,e=_o(window,[s])})}},K2=t=>()=>e=>n=>{(Ve(n,"DROP_COMPLETE")||Ve(n,"FLUSH")||Ve(n,"DROP_ANIMATE"))&&t.stopPublishing(),e(n)},j2=t=>{let e=!1;return()=>n=>o=>{if(Ve(o,"INITIAL_PUBLISH")){e=!0,t.tryRecordFocus(o.payload.critical.draggable.id),n(o),t.tryRestoreFocusRecorded();return}if(n(o),!!e){if(Ve(o,"FLUSH")){e=!1,t.tryRestoreFocusRecorded();return}if(Ve(o,"DROP_COMPLETE")){e=!1;let r=o.payload.completed.result;r.combine&&t.tryShiftRecord(r.draggableId,r.combine.draggableId),t.tryRestoreFocusRecorded()}}}},V2=t=>Ve(t,"DROP_COMPLETE")||Ve(t,"DROP_ANIMATE")||Ve(t,"FLUSH"),W2=t=>e=>n=>o=>{if(V2(o)){t.stop(),n(o);return}if(Ve(o,"INITIAL_PUBLISH")){n(o);let r=e.getState();r.phase!=="DRAGGING"&&j(),t.start(r);return}n(o),t.scroll(e.getState())},G2=t=>e=>n=>{if(e(n),!Ve(n,"PUBLISH_WHILE_DRAGGING"))return;let o=t.getState();o.phase==="DROP_PENDING"&&(o.isWaiting||t.dispatch(fT({reason:o.reason})))},Y2=dg,q2=({dimensionMarshal:t,focusMarshal:e,styleMarshal:n,getResponders:o,announce:r,autoScroller:i})=>lg(i2,Y2(qw(E2(n),K2(t),C2(t),D2,H2,U2,G2,W2(i),M2,j2(e),z2(o,r)))),wg=()=>({additions:{},removals:{},modified:{}});function J2({registry:t,callbacks:e}){let n=wg(),o=null,r=()=>{o||(e.collectionStarting(),o=requestAnimationFrame(()=>{o=null,oc();let{additions:l,removals:c,modified:d}=n,u=Object.keys(l).map(g=>t.draggable.getById(g).getDimension(Wt)).sort((g,m)=>g.descriptor.index-m.descriptor.index),p=Object.keys(d).map(g=>{let _=t.droppable.getById(g).callbacks.getScrollWhileDragging();return{droppableId:g,scroll:_}}),h={additions:u,removals:Object.keys(c),modified:p};n=wg(),rc(),e.publish(h)}))};return{add:l=>{let c=l.descriptor.id;n.additions[c]=l,n.modified[l.descriptor.droppableId]=!0,n.removals[c]&&delete n.removals[c],r()},remove:l=>{let c=l.descriptor;n.removals[c.id]=!0,n.modified[c.droppableId]=!0,n.additions[c.id]&&delete n.additions[c.id],r()},stop:()=>{o&&(cancelAnimationFrame(o),o=null,n=wg())}}}var bT=({scrollHeight:t,scrollWidth:e,height:n,width:o})=>{let r=Zn({x:e,y:t},{x:o,y:n});return{x:Math.max(0,r.x),y:Math.max(0,r.y)}},yT=()=>{let t=document.documentElement;return t||j(),t},xT=()=>{let t=yT();return bT({scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,width:t.clientWidth,height:t.clientHeight})},X2=()=>{let t=_T(),e=xT(),n=t.y,o=t.x,r=yT(),i=r.clientWidth,s=r.clientHeight,a=o+i,l=n+s;return{frame:mo({top:n,left:o,right:a,bottom:l}),scroll:{initial:t,current:t,max:e,diff:{value:Wt,displacement:Wt}}}},Z2=({critical:t,scrollOptions:e,registry:n})=>{oc();let o=X2(),r=o.scroll.current,i=t.droppable,s=n.droppable.getAllByType(i.type).map(d=>d.callbacks.getDimensionAndWatchScroll(r,e)),a=n.draggable.getAllByType(t.draggable.type).map(d=>d.getDimension(r)),l={draggables:Y0(a),droppables:G0(s)};return rc(),{dimensions:l,critical:t,viewport:o}};function k0(t,e,n){return!(n.descriptor.id===e.id||n.descriptor.type!==e.type||t.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var Q2=(t,e)=>{let n=null,o=J2({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting},registry:t}),r=(p,h)=>{t.droppable.exists(p)||j(),n&&e.updateDroppableIsEnabled({id:p,isEnabled:h})},i=(p,h)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableIsCombineEnabled({id:p,isCombineEnabled:h}))},s=(p,h)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableScroll({id:p,newScroll:h}))},a=(p,h)=>{n&&t.droppable.getById(p).callbacks.scroll(h)},l=()=>{if(!n)return;o.stop();let p=n.critical.droppable;t.droppable.getAllByType(p.type).forEach(h=>h.callbacks.dragStopped()),n.unsubscribe(),n=null},c=p=>{n||j();let h=n.critical.draggable;p.type==="ADDITION"&&k0(t,h,p.value)&&o.add(p.value),p.type==="REMOVAL"&&k0(t,h,p.value)&&o.remove(p.value)};return{updateDroppableIsEnabled:r,updateDroppableIsCombineEnabled:i,scrollDroppable:a,updateDroppableScroll:s,startPublishing:p=>{n&&j();let h=t.draggable.getById(p.draggableId),g=t.droppable.getById(h.descriptor.droppableId),m={draggable:h.descriptor,droppable:g.descriptor},_=t.subscribe(c);return n={critical:m,unsubscribe:_},Z2({critical:m,registry:t,scrollOptions:p.scrollOptions})},stopPublishing:l}},vT=(t,e)=>t.phase==="IDLE"?!0:t.phase!=="DROP_ANIMATING"||t.completed.result.draggableId===e?!1:t.completed.result.reason==="DROP",e$=t=>{window.scrollBy(t.x,t.y)},t$=Vt(t=>Eu(t).filter(e=>!(!e.isEnabled||!e.frame))),n$=(t,e)=>t$(e).find(o=>(o.frame||j(),rT(o.frame.pageMarginBox)(t)))||null,o$=({center:t,destination:e,droppables:n})=>{if(e){let r=n[e];return r.frame?r:null}return n$(t,n)},Zl={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:t=>t**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1},r$=(t,e,n=()=>Zl)=>{let o=n(),r=t[e.size]*o.startFromPercentage,i=t[e.size]*o.maxScrollAtPercentage;return{startScrollingFrom:r,maxScrollValueAt:i}},CT=({startOfRange:t,endOfRange:e,current:n})=>{let o=e-t;return o===0?0:(n-t)/o},qg=1,i$=(t,e,n=()=>Zl)=>{let o=n();if(t>e.startScrollingFrom)return 0;if(t<=e.maxScrollValueAt)return o.maxPixelScroll;if(t===e.startScrollingFrom)return qg;let i=1-CT({startOfRange:e.maxScrollValueAt,endOfRange:e.startScrollingFrom,current:t}),s=o.maxPixelScroll*o.ease(i);return Math.ceil(s)},s$=(t,e,n)=>{let o=n(),r=o.durationDampening.accelerateAt,i=o.durationDampening.stopDampeningAt,s=e,a=i,c=Date.now()-s;if(c>=i)return t;if(c<r)return qg;let d=CT({startOfRange:r,endOfRange:a,current:c}),u=t*o.ease(d);return Math.ceil(u)},N0=({distanceToEdge:t,thresholds:e,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:r})=>{let i=i$(t,e,r);return i===0?0:o?Math.max(s$(i,n,r),qg):i},D0=({container:t,distanceToEdges:e,dragStartTime:n,axis:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=r$(t,o,i);return e[o.end]<e[o.start]?N0({distanceToEdge:e[o.end],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i}):-1*N0({distanceToEdge:e[o.start],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i})},a$=({container:t,subject:e,proposedScroll:n})=>{let o=e.height>t.height,r=e.width>t.width;return!r&&!o?n:r&&o?null:{x:r?0:n.x,y:o?0:n.y}},l$=W0(t=>t===0?0:t),ET=({dragStartTime:t,container:e,subject:n,center:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s={top:o.y-e.top,right:e.right-o.x,bottom:e.bottom-o.y,left:o.x-e.left},a=D0({container:e,distanceToEdges:s,dragStartTime:t,axis:Hg,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),l=D0({container:e,distanceToEdges:s,dragStartTime:t,axis:X0,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),c=l$({x:l,y:a});if(di(c,Wt))return null;let d=a$({container:e,subject:n,proposedScroll:c});return d?di(d,Wt)?null:d:null},c$=W0(t=>t===0?0:t>0?1:-1),Jg=(()=>{let t=(e,n)=>e<0?e:e>n?e-n:0;return({current:e,max:n,change:o})=>{let r=sn(e,o),i={x:t(r.x,n.x),y:t(r.y,n.y)};return di(i,Wt)?null:i}})(),wT=({max:t,current:e,change:n})=>{let o={x:Math.max(e.x,t.x),y:Math.max(e.y,t.y)},r=c$(n),i=Jg({max:o,current:e,change:r});return!i||r.x!==0&&i.x===0||r.y!==0&&i.y===0},Xg=(t,e)=>wT({current:t.scroll.current,max:t.scroll.max,change:e}),d$=(t,e)=>{if(!Xg(t,e))return null;let n=t.scroll.max,o=t.scroll.current;return Jg({current:o,max:n,change:e})},Zg=(t,e)=>{let n=t.frame;return n?wT({current:n.scroll.current,max:n.scroll.max,change:e}):!1},u$=(t,e)=>{let n=t.frame;return!n||!Zg(t,e)?null:Jg({current:n.scroll.current,max:n.scroll.max,change:e})},p$=({viewport:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=ET({dragStartTime:o,container:t.frame,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return s&&Xg(t,s)?s:null},f$=({droppable:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=t.frame;if(!s)return null;let a=ET({dragStartTime:o,container:s.pageMarginBox,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return a&&Zg(t,a)?a:null},O0=({state:t,dragStartTime:e,shouldUseTimeDampening:n,scrollWindow:o,scrollDroppable:r,getAutoScrollerOptions:i})=>{let s=t.current.page.borderBoxCenter,l=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){let u=t.viewport,p=p$({dragStartTime:e,viewport:u,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(p){o(p);return}}let c=o$({center:s,destination:Qn(t.impact),droppables:t.dimensions.droppables});if(!c)return;let d=f$({dragStartTime:e,droppable:c,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});d&&r(c.descriptor.id,d)},h$=({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n=()=>Zl})=>{let o=la(t),r=la(e),i=null,s=c=>{i||j();let{shouldUseTimeDampening:d,dragStartTime:u}=i;O0({state:c,scrollWindow:o,scrollDroppable:r,dragStartTime:u,shouldUseTimeDampening:d,getAutoScrollerOptions:n})};return{start:c=>{oc(),i&&j();let d=Date.now(),u=!1,p=()=>{u=!0};O0({state:c,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:p,scrollDroppable:p,getAutoScrollerOptions:n}),i={dragStartTime:d,shouldUseTimeDampening:u},rc(),u&&s(c)},stop:()=>{i&&(o.cancel(),r.cancel(),i=null)},scroll:s}},g$=({move:t,scrollDroppable:e,scrollWindow:n})=>{let o=(a,l)=>{let c=sn(a.current.client.selection,l);t({client:c})},r=(a,l)=>{if(!Zg(a,l))return l;let c=u$(a,l);if(!c)return e(a.descriptor.id,l),null;let d=Zn(l,c);return e(a.descriptor.id,d),Zn(l,d)},i=(a,l,c)=>{if(!a||!Xg(l,c))return c;let d=d$(l,c);if(!d)return n(c),null;let u=Zn(c,d);return n(u),Zn(c,u)};return a=>{let l=a.scrollJumpRequest;if(!l)return;let c=Qn(a.impact);c||j();let d=r(a.dimensions.droppables[c],l);if(!d)return;let u=a.viewport,p=i(a.isWindowScrollAllowed,u,d);p&&o(a,p)}},m$=({scrollDroppable:t,scrollWindow:e,move:n,getAutoScrollerOptions:o})=>{let r=h$({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:o}),i=g$({move:n,scrollWindow:e,scrollDroppable:t});return{scroll:l=>{if(!(o().disabled||l.phase!=="DRAGGING")){if(l.movementMode==="FLUID"){r.scroll(l);return}l.scrollJumpRequest&&i(l)}},start:r.start,stop:r.stop}},da="data-rfd",ua=(()=>{let t=`${da}-drag-handle`;return{base:t,draggableId:`${t}-draggable-id`,contextId:`${t}-context-id`}})(),Pg=(()=>{let t=`${da}-draggable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),_$=(()=>{let t=`${da}-droppable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),I0={contextId:`${da}-scroll-container-context-id`},b$=t=>e=>`[${e}="${t}"]`,jl=(t,e)=>t.map(n=>{let o=n.styles[e];return o?`${n.selector} { ${o} }`:""}).join(" "),y$="pointer-events: none;",x$=t=>{let e=b$(t),n=(()=>{let a=`
65
+ cursor: -webkit-grab;
66
+ cursor: grab;
67
+ `;return{selector:e(ua.contextId),styles:{always:`
68
+ -webkit-touch-callout: none;
69
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
70
+ touch-action: manipulation;
71
+ `,resting:a,dragging:y$,dropAnimating:a}}})(),o=(()=>{let a=`
72
+ transition: ${Gl.outOfTheWay};
73
+ `;return{selector:e(Pg.contextId),styles:{dragging:a,dropAnimating:a,userCancel:a}}})(),r={selector:e(_$.contextId),styles:{always:"overflow-anchor: none;"}},s=[o,n,r,{selector:"body",styles:{dragging:`
74
+ cursor: grabbing;
75
+ cursor: -webkit-grabbing;
76
+ user-select: none;
77
+ -webkit-user-select: none;
78
+ -moz-user-select: none;
79
+ -ms-user-select: none;
80
+ overflow-anchor: none;
81
+ `}}];return{always:jl(s,"always"),resting:jl(s,"resting"),dragging:jl(s,"dragging"),dropAnimating:jl(s,"dropAnimating"),userCancel:jl(s,"userCancel")}},eo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?_n:F,Tg=()=>{let t=document.querySelector("head");return t||j(),t},A0=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function v$(t,e){let n=Pe(()=>x$(t),[t]),o=J(null),r=J(null),i=le(Vt(u=>{let p=r.current;p||j(),p.textContent=u}),[]),s=le(u=>{let p=o.current;p||j(),p.textContent=u},[]);eo(()=>{!o.current&&!r.current||j();let u=A0(e),p=A0(e);return o.current=u,r.current=p,u.setAttribute(`${da}-always`,t),p.setAttribute(`${da}-dynamic`,t),Tg().appendChild(u),Tg().appendChild(p),s(n.always),i(n.resting),()=>{let h=g=>{let m=g.current;m||j(),Tg().removeChild(m),g.current=null};h(o),h(r)}},[e,s,i,n.always,n.resting,t]);let a=le(()=>i(n.dragging),[i,n.dragging]),l=le(u=>{if(u==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=le(()=>{r.current&&i(n.resting)},[i,n.resting]);return Pe(()=>({dragging:a,dropping:l,resting:c}),[a,l,c])}function TT(t,e){return Array.from(t.querySelectorAll(e))}var ST=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function ic(t){return t instanceof ST(t).HTMLElement}function kT(t,e){let n=`[${ua.contextId}="${t}"]`,o=TT(document,n);if(!o.length)return null;let r=o.find(i=>i.getAttribute(ua.draggableId)===e);return!r||!ic(r)?null:r}function C$(t){let e=J({}),n=J(null),o=J(null),r=J(!1),i=le(function(p,h){let g={id:p,focus:h};return e.current[p]=g,function(){let _=e.current;_[p]!==g&&delete _[p]}},[]),s=le(function(p){let h=kT(t,p);h&&h!==document.activeElement&&h.focus()},[t]),a=le(function(p,h){n.current===p&&(n.current=h)},[]),l=le(function(){o.current||r.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let p=n.current;p&&s(p)}))},[s]),c=le(function(p){n.current=null;let h=document.activeElement;h&&h.getAttribute(ua.draggableId)===p&&(n.current=p)},[]);return eo(()=>(r.current=!0,function(){r.current=!1;let p=o.current;p&&cancelAnimationFrame(p)}),[]),Pe(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:a}),[i,c,l,a])}function E$(){let t={draggables:{},droppables:{}},e=[];function n(u){return e.push(u),function(){let h=e.indexOf(u);h!==-1&&e.splice(h,1)}}function o(u){e.length&&e.forEach(p=>p(u))}function r(u){return t.draggables[u]||null}function i(u){let p=r(u);return p||j(),p}let s={register:u=>{t.draggables[u.descriptor.id]=u,o({type:"ADDITION",value:u})},update:(u,p)=>{let h=t.draggables[p.descriptor.id];h&&h.uniqueId===u.uniqueId&&(delete t.draggables[p.descriptor.id],t.draggables[u.descriptor.id]=u)},unregister:u=>{let p=u.descriptor.id,h=r(p);h&&u.uniqueId===h.uniqueId&&(delete t.draggables[p],t.droppables[u.descriptor.droppableId]&&o({type:"REMOVAL",value:u}))},getById:i,findById:r,exists:u=>!!r(u),getAllByType:u=>Object.values(t.draggables).filter(p=>p.descriptor.type===u)};function a(u){return t.droppables[u]||null}function l(u){let p=a(u);return p||j(),p}let c={register:u=>{t.droppables[u.descriptor.id]=u},unregister:u=>{let p=a(u.descriptor.id);p&&u.uniqueId===p.uniqueId&&delete t.droppables[u.descriptor.id]},getById:l,findById:a,exists:u=>!!a(u),getAllByType:u=>Object.values(t.droppables).filter(p=>p.descriptor.type===u)};function d(){t.draggables={},t.droppables={},e.length=0}return{draggable:s,droppable:c,subscribe:n,clean:d}}function w$(){let t=Pe(E$,[]);return F(()=>function(){t.clean()},[t]),t}var Qg=nt.createContext(null),Ql=()=>{let t=document.body;return t||j(),t},T$={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},S$=t=>`rfd-announcement-${t}`;function k$(t){let e=Pe(()=>S$(t),[t]),n=J(null);return F(function(){let i=document.createElement("div");return n.current=i,i.id=e,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Dh(i.style,T$),Ql().appendChild(i),function(){setTimeout(function(){let l=Ql();l.contains(i)&&l.removeChild(i),i===n.current&&(n.current=null)})}},[e]),le(r=>{let i=n.current;if(i){i.textContent=r;return}},[])}var N$={separator:"::"};function em(t,e=N$){let n=nt.useId();return Pe(()=>`${t}${e.separator}${n}`,[e.separator,t,n])}function D$({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function O$({contextId:t,text:e}){let n=em("hidden-text",{separator:"-"}),o=Pe(()=>D$({contextId:t,uniqueId:n}),[n,t]);return F(function(){let i=document.createElement("div");return i.id=o,i.textContent=e,i.style.display="none",Ql().appendChild(i),function(){let a=Ql();a.contains(i)&&a.removeChild(i)}},[o,e]),o}var ku=nt.createContext(null),I$={react:"^18.0.0 || ^19.0.0"},A$=/(\d+)\.(\d+)\.(\d+)/,M0=t=>{let e=A$.exec(t);e==null&&j();let n=Number(e[1]),o=Number(e[2]),r=Number(e[3]);return{major:n,minor:o,patch:r,raw:t}},M$=(t,e)=>e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>=t.patch,L$=(t,e)=>{let n=M0(t),o=M0(e);M$(n,o)};var R$=t=>{let e=t.doctype;e&&(e.name.toLowerCase(),e.publicId)};function sc(t,e){}function P$(){sc(()=>{L$(I$.react,nt.version),R$(document)},[])}function tm(t){let e=J(t);return F(()=>{e.current=t}),e}function F$(){let t=null;function e(){return!!t}function n(s){return s===t}function o(s){t&&j();let a={abandon:s};return t=a,a}function r(){t||j(),t=null}function i(){t&&(t.abandon(),r())}return{isClaimed:e,isActive:n,claim:o,release:r,tryAbandon:i}}function ec(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}var B$=9,$$=13,nm=27,NT=32,z$=33,H$=34,U$=35,K$=36,j$=37,V$=38,W$=39,G$=40,Y$={[$$]:!0,[B$]:!0},DT=t=>{Y$[t.keyCode]&&t.preventDefault()},Nu=(()=>{let t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(o=>`on${o}`in document)||t})(),OT=0,L0=5;function q$(t,e){return Math.abs(e.x-t.x)>=L0||Math.abs(e.y-t.y)>=L0}var R0={type:"IDLE"};function J$({cancel:t,completed:e,getPhase:n,setPhase:o}){return[{eventName:"mousemove",fn:r=>{let{button:i,clientX:s,clientY:a}=r;if(i!==OT)return;let l={x:s,y:a},c=n();if(c.type==="DRAGGING"){r.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&j();let d=c.point;if(!q$(d,l))return;r.preventDefault();let u=c.actions.fluidLift(l);o({type:"DRAGGING",actions:u})}},{eventName:"mouseup",fn:r=>{let i=n();if(i.type!=="DRAGGING"){t();return}r.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:r=>{n().type==="DRAGGING"&&r.preventDefault(),t()}},{eventName:"keydown",fn:r=>{if(n().type==="PENDING"){t();return}if(r.keyCode===nm){r.preventDefault(),t();return}DT(r)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:r=>{let i=n();if(i.type==="IDLE"&&j(),i.actions.shouldRespectForcePress()){t();return}r.preventDefault()}},{eventName:Nu,fn:t}]}function X$(t){let e=J(R0),n=J(ci),o=Pe(()=>({eventName:"mousedown",fn:function(u){if(u.defaultPrevented||u.button!==OT||u.ctrlKey||u.metaKey||u.shiftKey||u.altKey)return;let p=t.findClosestDraggableId(u);if(!p)return;let h=t.tryGetLock(p,s,{sourceEvent:u});if(!h)return;u.preventDefault();let g={x:u.clientX,y:u.clientY};n.current(),c(h,g)}}),[t]),r=Pe(()=>({eventName:"webkitmouseforcewillbegin",fn:d=>{if(d.defaultPrevented)return;let u=t.findClosestDraggableId(d);if(!u)return;let p=t.findOptionsForDraggable(u);p&&(p.shouldRespectForcePress||t.canGetLock(u)&&d.preventDefault())}}),[t]),i=le(function(){let u={passive:!1,capture:!0};n.current=_o(window,[r,o],u)},[r,o]),s=le(()=>{e.current.type!=="IDLE"&&(e.current=R0,n.current(),i())},[i]),a=le(()=>{let d=e.current;s(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[s]),l=le(function(){let u={capture:!0,passive:!1},p=J$({cancel:a,completed:s,getPhase:()=>e.current,setPhase:h=>{e.current=h}});n.current=_o(window,p,u)},[a,s]),c=le(function(u,p){e.current.type!=="IDLE"&&j(),e.current={type:"PENDING",point:p,actions:u},l()},[l]);eo(function(){return i(),function(){n.current()}},[i])}function Z$(){}var Q$={[H$]:!0,[z$]:!0,[K$]:!0,[U$]:!0};function ez(t,e){function n(){e(),t.cancel()}function o(){e(),t.drop()}return[{eventName:"keydown",fn:r=>{if(r.keyCode===nm){r.preventDefault(),n();return}if(r.keyCode===NT){r.preventDefault(),o();return}if(r.keyCode===G$){r.preventDefault(),t.moveDown();return}if(r.keyCode===V$){r.preventDefault(),t.moveUp();return}if(r.keyCode===W$){r.preventDefault(),t.moveRight();return}if(r.keyCode===j$){r.preventDefault(),t.moveLeft();return}if(Q$[r.keyCode]){r.preventDefault();return}DT(r)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:Nu,fn:n}]}function tz(t){let e=J(Z$),n=Pe(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==NT)return;let s=t.findClosestDraggableId(i);if(!s)return;let a=t.tryGetLock(s,d,{sourceEvent:i});if(!a)return;i.preventDefault();let l=!0,c=a.snapLift();e.current();function d(){l||j(),l=!1,e.current(),o()}e.current=_o(window,ez(c,d),{capture:!0,passive:!1})}}),[t]),o=le(function(){let i={passive:!1,capture:!0};e.current=_o(window,[n],i)},[n]);eo(function(){return o(),function(){e.current()}},[o])}var Sg={type:"IDLE"},nz=120,oz=.15;function rz({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(e().type!=="DRAGGING"){t();return}n.keyCode===nm&&n.preventDefault(),t()}},{eventName:Nu,fn:t}]}function iz({cancel:t,completed:e,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}r.hasMoved=!0;let{clientX:i,clientY:s}=o.touches[0],a={x:i,y:s};o.preventDefault(),r.actions.move(a)}},{eventName:"touchend",fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}o.preventDefault(),r.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:o=>{if(n().type!=="DRAGGING"){t();return}o.preventDefault(),t()}},{eventName:"touchforcechange",fn:o=>{let r=n();r.type==="IDLE"&&j();let i=o.touches[0];if(!i||!(i.force>=oz))return;let a=r.actions.shouldRespectForcePress();if(r.type==="PENDING"){a&&t();return}if(a){if(r.hasMoved){o.preventDefault();return}t();return}o.preventDefault()}},{eventName:Nu,fn:t}]}function sz(t){let e=J(Sg),n=J(ci),o=le(function(){return e.current},[]),r=le(function(h){e.current=h},[]),i=Pe(()=>({eventName:"touchstart",fn:function(h){if(h.defaultPrevented)return;let g=t.findClosestDraggableId(h);if(!g)return;let m=t.tryGetLock(g,a,{sourceEvent:h});if(!m)return;let _=h.touches[0],{clientX:b,clientY:y}=_,v={x:b,y};n.current(),u(m,v)}}),[t]),s=le(function(){let h={capture:!0,passive:!1};n.current=_o(window,[i],h)},[i]),a=le(()=>{let p=e.current;p.type!=="IDLE"&&(p.type==="PENDING"&&clearTimeout(p.longPressTimerId),r(Sg),n.current(),s())},[s,r]),l=le(()=>{let p=e.current;a(),p.type==="DRAGGING"&&p.actions.cancel({shouldBlockNextClick:!0}),p.type==="PENDING"&&p.actions.abort()},[a]),c=le(function(){let h={capture:!0,passive:!1},g={cancel:l,completed:a,getPhase:o},m=_o(window,iz(g),h),_=_o(window,rz(g),h);n.current=function(){m(),_()}},[l,o,a]),d=le(function(){let h=o();h.type!=="PENDING"&&j();let g=h.actions.fluidLift(h.point);r({type:"DRAGGING",actions:g,hasMoved:!1})},[o,r]),u=le(function(h,g){o().type!=="IDLE"&&j();let m=setTimeout(d,nz);r({type:"PENDING",point:g,actions:h,longPressTimerId:m}),c()},[c,o,r,d]);eo(function(){return s(),function(){n.current();let g=o();g.type==="PENDING"&&(clearTimeout(g.longPressTimerId),r(Sg))}},[o,s,r]),eo(function(){return _o(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function az(t){}var lz=["input","button","textarea","select","option","optgroup","video","audio"];function IT(t,e){if(e==null)return!1;if(lz.includes(e.tagName.toLowerCase()))return!0;let o=e.getAttribute("contenteditable");return o==="true"||o===""?!0:e===t?!1:IT(t,e.parentElement)}function cz(t,e){let n=e.target;return ic(n)?IT(t,n):!1}var dz=t=>mo(t.getBoundingClientRect()).center;function uz(t){return t instanceof ST(t).Element}var pz=(()=>{let t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(o=>o in Element.prototype)||t})();function AT(t,e){return t==null?null:t[pz](e)?t:AT(t.parentElement,e)}function fz(t,e){return t.closest?t.closest(e):AT(t,e)}function hz(t){return`[${ua.contextId}="${t}"]`}function gz(t,e){let n=e.target;if(!uz(n))return null;let o=hz(t),r=fz(n,o);return!r||!ic(r)?null:r}function mz(t,e){let n=gz(t,e);return n?n.getAttribute(ua.draggableId):null}function _z(t,e){let n=`[${Pg.contextId}="${t}"]`,r=TT(document,n).find(i=>i.getAttribute(Pg.id)===e);return!r||!ic(r)?null:r}function bz(t){t.preventDefault()}function _u({expected:t,phase:e,isLockActive:n,shouldWarn:o}){return!(!n()||t!==e)}function MT({lockAPI:t,store:e,registry:n,draggableId:o}){if(t.isClaimed())return!1;let r=n.draggable.findById(o);return!(!r||!r.options.isEnabled||!vT(e.getState(),o))}function yz({lockAPI:t,contextId:e,store:n,registry:o,draggableId:r,forceSensorStop:i,sourceEvent:s}){if(!MT({lockAPI:t,store:n,registry:o,draggableId:r}))return null;let l=o.draggable.getById(r),c=_z(e,l.descriptor.id);if(!c||s&&!l.options.canDragInteractiveElements&&cz(c,s))return null;let d=t.claim(i||ci),u="PRE_DRAG";function p(){return l.options.shouldRespectForcePress}function h(){return t.isActive(d)}function g(C,E){_u({expected:C,phase:u,isLockActive:h,shouldWarn:!0})&&n.dispatch(E())}let m=g.bind(null,"DRAGGING");function _(C){function E(){t.release(),u="COMPLETED"}u!=="PRE_DRAG"&&(E(),j()),n.dispatch(a2(C.liftActionArgs)),u="DRAGGING";function k(T,w={shouldBlockNextClick:!1}){if(C.cleanup(),w.shouldBlockNextClick){let S=_o(window,[{eventName:"click",fn:bz,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(S)}E(),n.dispatch(fT({reason:T}))}return{isActive:()=>_u({expected:"DRAGGING",phase:u,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:p,drop:T=>k("DROP",T),cancel:T=>k("CANCEL",T),...C.actions}}function b(C){let E=la(T=>{m(()=>pT({client:T}))});return{..._({liftActionArgs:{id:r,clientSelection:C,movementMode:"FLUID"},cleanup:()=>E.cancel(),actions:{move:E}}),move:E}}function y(){let C={moveUp:()=>m(m2),moveRight:()=>m(b2),moveDown:()=>m(_2),moveLeft:()=>m(y2)};return _({liftActionArgs:{id:r,clientSelection:dz(c),movementMode:"SNAP"},cleanup:ci,actions:C})}function v(){_u({expected:"PRE_DRAG",phase:u,isLockActive:h,shouldWarn:!0})&&t.release()}return{isActive:()=>_u({expected:"PRE_DRAG",phase:u,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:p,fluidLift:b,snapLift:y,abort:v}}var xz=[X$,tz,sz];function vz({contextId:t,store:e,registry:n,customSensors:o,enableDefaultSensors:r}){let i=[...r?xz:[],...o||[]],s=L(()=>F$())[0],a=le(function(_,b){ec(_)&&!ec(b)&&s.tryAbandon()},[s]);eo(function(){let _=e.getState();return e.subscribe(()=>{let y=e.getState();a(_,y),_=y})},[s,e,a]),eo(()=>s.tryAbandon,[s.tryAbandon]);let l=le(m=>MT({lockAPI:s,registry:n,store:e,draggableId:m}),[s,n,e]),c=le((m,_,b)=>yz({lockAPI:s,registry:n,contextId:t,store:e,draggableId:m,forceSensorStop:_||null,sourceEvent:b&&b.sourceEvent?b.sourceEvent:null}),[t,s,n,e]),d=le(m=>mz(t,m),[t]),u=le(m=>{let _=n.draggable.findById(m);return _?_.options:null},[n.draggable]),p=le(function(){s.isClaimed()&&(s.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(Wg()))},[s,e]),h=le(()=>s.isClaimed(),[s]),g=Pe(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:d,findOptionsForDraggable:u,tryReleaseLock:p,isLockClaimed:h}),[l,c,d,u,p,h]);az(i);for(let m=0;m<i.length;m++)i[m](g)}var Cz=t=>({onBeforeCapture:e=>{Dl(()=>{t.onBeforeCapture&&t.onBeforeCapture(e)})},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),Ez=t=>({...Zl,...t.autoScrollerOptions,durationDampening:{...Zl.durationDampening,...t.autoScrollerOptions}});function Vl(t){return t.current||j(),t.current}function wz(t){let{contextId:e,setCallbacks:n,sensors:o,nonce:r,dragHandleUsageInstructions:i}=t,s=J(null);P$();let a=tm(t),l=le(()=>Cz(a.current),[a]),c=le(()=>Ez(a.current),[a]),d=k$(e),u=O$({contextId:e,text:i}),p=v$(e,r),h=le(S=>{Vl(s).dispatch(S)},[]),g=Pe(()=>cg({publishWhileDragging:c2,updateDroppableScroll:u2,updateDroppableIsEnabled:p2,updateDroppableIsCombineEnabled:f2,collectionStarting:d2},h),[h]),m=w$(),_=Pe(()=>Q2(m,g),[m,g]),b=Pe(()=>m$({scrollWindow:e$,scrollDroppable:_.scrollDroppable,getAutoScrollerOptions:c,...cg({move:pT},h)}),[_.scrollDroppable,h,c]),y=C$(e),v=Pe(()=>q2({announce:d,autoScroller:b,dimensionMarshal:_,focusMarshal:y,getResponders:l,styleMarshal:p}),[d,b,_,y,l,p]);s.current=v;let x=le(()=>{let S=Vl(s);S.getState().phase!=="IDLE"&&S.dispatch(Wg())},[]),C=le(()=>{let S=Vl(s).getState();return S.phase==="DROP_ANIMATING"?!0:S.phase==="IDLE"?!1:S.isDragging},[]),E=Pe(()=>({isDragging:C,tryAbort:x}),[C,x]);n(E);let k=le(S=>vT(Vl(s).getState(),S),[]),T=le(()=>rs(Vl(s).getState()),[]),w=Pe(()=>({marshal:_,focus:y,contextId:e,canLift:k,isMovementAllowed:T,dragHandleUsageInstructionsId:u,registry:m}),[e,_,u,y,k,T,m]);return vz({contextId:e,store:v,registry:m,customSensors:o||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),F(()=>x,[x]),nt.createElement(ku.Provider,{value:w},nt.createElement(u0,{context:Qg,store:v},t.children))}function Tz(){return nt.useId()}function Du(t){let e=Tz(),n=t.dragHandleUsageInstructions||yu.dragHandleUsageInstructions;return nt.createElement(Ig,null,o=>nt.createElement(wz,{nonce:t.nonce,contextId:e,setCallbacks:o,dragHandleUsageInstructions:n,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}var P0={dragging:5e3,dropAnimating:4500},Sz=(t,e)=>e?Gl.drop(e.duration):t?Gl.snap:Gl.fluid,kz=(t,e)=>{if(t)return e?Xl.opacity.drop:Xl.opacity.combining},Nz=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function Dz(t){let n=t.dimension.client,{offset:o,combineWith:r,dropping:i}=t,s=!!r,a=Nz(t),l=!!i,c=l?Lg.drop(o,s):Lg.moveTo(o);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:Sz(a,i),transform:c,opacity:kz(s,l),zIndex:l?P0.dropAnimating:P0.dragging,pointerEvents:"none"}}function Oz(t){return{transform:Lg.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function Iz(t){return t.type==="DRAGGING"?Dz(t):Oz(t)}function Az(t,e,n=Wt){let o=window.getComputedStyle(e),r=e.getBoundingClientRect(),i=yg(r,o),s=Ul(i,n),a={client:i,tagName:e.tagName.toLowerCase(),display:o.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:t,placeholder:a,displaceBy:l,client:i,page:s}}function Mz(t){let e=em("draggable"),{descriptor:n,registry:o,getDraggableRef:r,canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}=t,l=Pe(()=>({canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}),[i,a,s]),c=le(h=>{let g=r();return g||j(),Az(n,g,h)},[n,r]),d=Pe(()=>({uniqueId:e,descriptor:n,options:l,getDimension:c}),[n,c,l,e]),u=J(d),p=J(!0);eo(()=>(o.draggable.register(u.current),()=>o.draggable.unregister(u.current)),[o.draggable]),eo(()=>{if(p.current){p.current=!1;return}let h=u.current;u.current=d,o.draggable.update(d,h)},[d,o.draggable])}var om=nt.createContext(null);function LT(t){t&&ic(t)||j()}function Lz(t,e,n){sc(()=>{function o(i){return`Draggable[id: ${i}]: `}let r=t.draggableId;r||j(!1),typeof r!="string"&&j(!1),Number.isInteger(t.index)||j(!1),t.mapped.type!=="DRAGGING"&&(LT(n()),t.isEnabled&&(kT(e,r)||j(!1)))})}function Rz(t){}function Cu(t){let e=ft(t);return e||j(),e}function Pz(t){t.preventDefault()}var Fz=t=>{let e=J(null),n=le((E=null)=>{e.current=E},[]),o=le(()=>e.current,[]),{contextId:r,dragHandleUsageInstructionsId:i,registry:s}=Cu(ku),{type:a,droppableId:l}=Cu(om),c=Pe(()=>({id:t.draggableId,index:t.index,type:a,droppableId:l}),[t.draggableId,t.index,a,l]),{children:d,draggableId:u,isEnabled:p,shouldRespectForcePress:h,canDragInteractiveElements:g,isClone:m,mapped:_,dropAnimationFinished:b}=t;if(Lz(t,r,o),Rz(m),!m){let E=Pe(()=>({descriptor:c,registry:s,getDraggableRef:o,canDragInteractiveElements:g,shouldRespectForcePress:h,isEnabled:p}),[c,s,o,g,h,p]);Mz(E)}let y=Pe(()=>p?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":u,"data-rfd-drag-handle-context-id":r,draggable:!1,onDragStart:Pz}:null,[r,i,u,p]),v=le(E=>{_.type==="DRAGGING"&&_.dropping&&E.propertyName==="transform"&&Dl(b)},[b,_]),x=Pe(()=>{let E=Iz(_),k=_.type==="DRAGGING"&&_.dropping?v:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":r,"data-rfd-draggable-id":u,style:E,onTransitionEnd:k},dragHandleProps:y}},[r,y,u,_,v,n]),C=Pe(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return nt.createElement(nt.Fragment,null,d(x,_.snapshot,C))},RT=(t,e)=>t===e,PT=t=>{let{combine:e,destination:n}=t;return n?n.droppableId:e?e.droppableId:null},Bz=t=>t.combine?t.combine.draggableId:null,$z=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function zz(){let t=Vt((r,i)=>({x:r,y:i})),e=Vt((r,i,s=null,a=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:r,draggingOver:s,combineWith:a,combineTargetFor:null})),n=Vt((r,i,s,a,l=null,c=null,d=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:r,dimension:s,forceShouldAnimate:d,snapshot:e(i,a,l,c,null)}}));return(r,i)=>{if(ec(r)){if(r.critical.draggable.id!==i.draggableId)return null;let s=r.current.client.offset,a=r.dimensions.draggables[i.draggableId],l=Qn(r.impact),c=$z(r.impact),d=r.forceShouldAnimate;return n(t(s.x,s.y),r.movementMode,a,i.isClone,l,c,d)}if(r.phase==="DROP_ANIMATING"){let s=r.completed;if(s.result.draggableId!==i.draggableId)return null;let a=i.isClone,l=r.dimensions.draggables[i.draggableId],c=s.result,d=c.mode,u=PT(c),p=Bz(c),g={duration:r.dropDuration,curve:Yg.drop,moveTo:r.newHomeClientOffset,opacity:p?Xl.opacity.drop:null,scale:p?Xl.scale.drop:null};return{mapped:{type:"DRAGGING",offset:r.newHomeClientOffset,dimension:l,dropping:g,draggingOver:u,combineWith:p,mode:d,forceShouldAnimate:null,snapshot:e(d,a,u,p,g)}}}return null}}function FT(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}var Hz={mapped:{type:"SECONDARY",offset:Wt,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:FT(null)}};function Uz(){let t=Vt((s,a)=>({x:s,y:a})),e=Vt(FT),n=Vt((s,a=null,l)=>({mapped:{type:"SECONDARY",offset:s,combineTargetFor:a,shouldAnimateDisplacement:l,snapshot:e(a)}})),o=s=>s?n(Wt,s,!0):null,r=(s,a,l,c)=>{let d=l.displaced.visible[s],u=!!(c.inVirtualList&&c.effected[s]),p=wu(l),h=p&&p.draggableId===s?a:null;if(!d){if(!u)return o(h);if(l.displaced.invisible[s])return null;let _=pa(c.displacedBy.point),b=t(_.x,_.y);return n(b,h,!0)}if(u)return o(h);let g=l.displacedBy.point,m=t(g.x,g.y);return n(m,h,d.shouldAnimate)};return(s,a)=>{if(ec(s))return s.critical.draggable.id===a.draggableId?null:r(a.draggableId,s.critical.draggable.id,s.impact,s.afterCritical);if(s.phase==="DROP_ANIMATING"){let l=s.completed;return l.result.draggableId===a.draggableId?null:r(a.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}var Kz=()=>{let t=zz(),e=Uz();return(o,r)=>t(o,r)||e(o,r)||Hz},jz={dropAnimationFinished:hT},Vz=mg(Kz,jz,null,{context:Qg,areStatePropsEqual:RT})(Fz);function BT(t){return Cu(om).isUsingCloneFor===t.draggableId&&!t.isClone?null:nt.createElement(Vz,t)}function Ou(t){let e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,n=!!t.disableInteractiveElementBlocking,o=!!t.shouldRespectForcePress;return nt.createElement(BT,Dh({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:n,shouldRespectForcePress:o}))}var rm=t=>e=>t===e,Wz=rm("scroll"),Gz=rm("auto"),Yz=rm("visible"),F0=(t,e)=>e(t.overflowX)||e(t.overflowY),qz=(t,e)=>e(t.overflowX)&&e(t.overflowY),$T=t=>{let e=window.getComputedStyle(t),n={overflowX:e.overflowX,overflowY:e.overflowY};return F0(n,Wz)||F0(n,Gz)},Jz=()=>!1,zT=t=>t==null?null:t===document.body?Jz()?t:null:t===document.documentElement?null:$T(t)?t:zT(t.parentElement);var Fg=t=>({x:t.scrollLeft,y:t.scrollTop}),HT=t=>t?window.getComputedStyle(t).position==="fixed"?!0:HT(t.parentElement):!1,Xz=t=>{let e=zT(t),n=HT(t);return{closestScrollable:e,isFixedOnPage:n}},Zz=({descriptor:t,isEnabled:e,isCombineEnabled:n,isFixedOnPage:o,direction:r,client:i,page:s,closest:a})=>{let l=(()=>{if(!a)return null;let{scrollSize:p,client:h}=a,g=bT({scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,height:h.paddingBox.height,width:h.paddingBox.width});return{pageMarginBox:a.page.marginBox,frameClient:h,scrollSize:p,shouldClipSubject:a.shouldClipSubject,scroll:{initial:a.scroll,current:a.scroll,max:g,diff:{value:Wt,displacement:Wt}}}})(),c=r==="vertical"?Hg:X0,d=ca({page:s,withPlaceholder:null,axis:c,frame:l});return{descriptor:t,isCombineEnabled:n,isFixedOnPage:o,axis:c,isEnabled:e,client:i,page:s,frame:l,subject:d}},Qz=(t,e)=>{let n=xg(t);if(!e||t!==e)return n;let o=n.paddingBox.top-e.scrollTop,r=n.paddingBox.left-e.scrollLeft,i=o+e.scrollHeight,s=r+e.scrollWidth,l=hu({top:o,right:s,bottom:i,left:r},n.border);return gu({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})},eH=({ref:t,descriptor:e,env:n,windowScroll:o,direction:r,isDropDisabled:i,isCombineEnabled:s,shouldClipSubject:a})=>{let l=n.closestScrollable,c=Qz(t,l),d=Ul(c,o),u=(()=>{if(!l)return null;let h=xg(l),g={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:h,page:Ul(h,o),scroll:Fg(l),scrollSize:g,shouldClipSubject:a}})();return Zz({descriptor:e,isEnabled:!i,isCombineEnabled:s,isFixedOnPage:n.isFixedOnPage,direction:r,client:c,page:d,closest:u})},tH={passive:!1},nH={passive:!0},B0=t=>t.shouldPublishImmediately?tH:nH,bu=t=>t&&t.env.closestScrollable||null;function oH(t){let e=J(null),n=Cu(ku),o=em("droppable"),{registry:r,marshal:i}=n,s=tm(t),a=Pe(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),l=J(a),c=Pe(()=>Vt((x,C)=>{e.current||j();let E={x,y:C};i.updateDroppableScroll(a.id,E)}),[a.id,i]),d=le(()=>{let x=e.current;return!x||!x.env.closestScrollable?Wt:Fg(x.env.closestScrollable)},[]),u=le(()=>{let x=d();c(x.x,x.y)},[d,c]),p=Pe(()=>la(u),[u]),h=le(()=>{let x=e.current,C=bu(x);if(x&&C||j(),x.scrollOptions.shouldPublishImmediately){u();return}p()},[p,u]),g=le((x,C)=>{e.current&&j();let E=s.current,k=E.getDroppableRef();k||j();let T=Xz(k),w={ref:k,descriptor:a,env:T,scrollOptions:C};e.current=w;let S=eH({ref:k,descriptor:a,env:T,windowScroll:x,direction:E.direction,isDropDisabled:E.isDropDisabled,isCombineEnabled:E.isCombineEnabled,shouldClipSubject:!E.ignoreContainerClipping}),N=T.closestScrollable;return N&&(N.setAttribute(I0.contextId,n.contextId),N.addEventListener("scroll",h,B0(w.scrollOptions))),S},[n.contextId,a,h,s]),m=le(()=>{let x=e.current,C=bu(x);return x&&C||j(),Fg(C)},[]),_=le(()=>{let x=e.current;x||j();let C=bu(x);e.current=null,C&&(p.cancel(),C.removeAttribute(I0.contextId),C.removeEventListener("scroll",h,B0(x.scrollOptions)))},[h,p]),b=le(x=>{let C=e.current;C||j();let E=bu(C);E||j(),E.scrollTop+=x.y,E.scrollLeft+=x.x},[]),y=Pe(()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:m,dragStopped:_,scroll:b}),[_,g,m,b]),v=Pe(()=>({uniqueId:o,descriptor:a,callbacks:y}),[y,a,o]);eo(()=>(l.current=v.descriptor,r.droppable.register(v),()=>{e.current&&_(),r.droppable.unregister(v)}),[y,a,_,v,i,r.droppable]),eo(()=>{e.current&&i.updateDroppableIsEnabled(l.current.id,!t.isDropDisabled)},[t.isDropDisabled,i]),eo(()=>{e.current&&i.updateDroppableIsCombineEnabled(l.current.id,t.isCombineEnabled)},[t.isCombineEnabled,i])}function kg(){}var $0={width:0,height:0,margin:oB},rH=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>t||n==="close"?$0:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},iH=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>{let o=rH({isAnimatingOpenOnMount:t,placeholder:e,animate:n});return{display:e.display,boxSizing:"border-box",width:o.width,height:o.height,marginTop:o.margin.top,marginRight:o.margin.right,marginBottom:o.margin.bottom,marginLeft:o.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Gl.placeholder:null}},sH=t=>{let e=J(null),n=le(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:o,onTransitionEnd:r,onClose:i,contextId:s}=t,[a,l]=L(t.animate==="open");F(()=>a?o!=="open"?(n(),l(!1),kg):e.current?kg:(e.current=setTimeout(()=>{e.current=null,l(!1)}),n):kg,[o,a,n]);let c=le(u=>{u.propertyName==="height"&&(r(),o==="close"&&i())},[o,i,r]),d=iH({isAnimatingOpenOnMount:a,animate:t.animate,placeholder:t.placeholder});return nt.createElement(t.placeholder.tagName,{style:d,"data-rfd-placeholder-context-id":s,onTransitionEnd:c,ref:t.innerRef})},aH=nt.memo(sH);function Ng(t){return typeof t=="boolean"}function Dg(t,e){e.forEach(n=>n(t))}var lH=[function({props:e}){e.droppableId||j(),typeof e.droppableId!="string"&&j()},function({props:e}){Ng(e.isDropDisabled)||j(),Ng(e.isCombineEnabled)||j(),Ng(e.ignoreContainerClipping)||j()},function({getDroppableRef:e}){LT(e())}],cH=[function({props:e,getPlaceholderRef:n}){!e.placeholder||n()}],dH=[function({props:e}){e.renderClone||j()},function({getPlaceholderRef:e}){e()&&j()}];function uH(t){sc(()=>{Dg(t,lH),t.props.mode==="standard"&&Dg(t,cH),t.props.mode==="virtual"&&Dg(t,dH)})}var Bg=class extends nt.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,n){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;let e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}},pH=t=>{let e=ft(ku);e||j();let{contextId:n,isMovementAllowed:o}=e,r=J(null),i=J(null),{children:s,droppableId:a,type:l,mode:c,direction:d,ignoreContainerClipping:u,isDropDisabled:p,isCombineEnabled:h,snapshot:g,useClone:m,updateViewportMaxScroll:_,getContainerForClone:b}=t,y=le(()=>r.current,[]),v=le((D=null)=>{r.current=D},[]),x=le(()=>i.current,[]),C=le((D=null)=>{i.current=D},[]);uH({props:t,getDroppableRef:y,getPlaceholderRef:x});let E=le(()=>{o()&&_({maxScroll:xT()})},[o,_]);oH({droppableId:a,type:l,mode:c,direction:d,isDropDisabled:p,isCombineEnabled:h,ignoreContainerClipping:u,getDroppableRef:y});let k=Pe(()=>nt.createElement(Bg,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:D,data:O,animate:A})=>nt.createElement(aH,{placeholder:O,onClose:D,innerRef:C,animate:A,contextId:n,onTransitionEnd:E})),[n,E,t.placeholder,t.shouldAnimatePlaceholder,C]),T=Pe(()=>({innerRef:v,placeholder:k,droppableProps:{"data-rfd-droppable-id":a,"data-rfd-droppable-context-id":n}}),[n,a,k,v]),w=m?m.dragging.draggableId:null,S=Pe(()=>({droppableId:a,type:l,isUsingCloneFor:w}),[a,w,l]);function N(){if(!m)return null;let{dragging:D,render:O}=m,A=nt.createElement(BT,{draggableId:D.draggableId,index:D.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(I,R)=>O(I,R,D));return nt.createPortal(A,b())}return nt.createElement(om.Provider,{value:S},s(T,g),N())};function fH(){return document.body||j(),document.body}var z0={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:fH},UT=t=>{let e={...t},n;for(n in z0)t[n]===void 0&&(e={...e,[n]:z0[n]});return e},Og=(t,e)=>t===e.droppable.type,H0=(t,e)=>e.draggables[t.draggable.id],hH=()=>{let t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},n=Vt(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),o=Vt((i,s,a,l,c,d)=>{let u=c.descriptor.id;if(c.descriptor.droppableId===i){let g=d?{render:d,dragging:n(c.descriptor)}:null,m={isDraggingOver:a,draggingOverWith:a?u:null,draggingFromThisWith:u,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:m,useClone:g}}if(!s)return e;if(!l)return t;let h={isDraggingOver:a,draggingOverWith:u,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:h,useClone:null}});return(i,s)=>{let a=UT(s),l=a.droppableId,c=a.type,d=!a.isDropDisabled,u=a.renderClone;if(ec(i)){let p=i.critical;if(!Og(c,p))return e;let h=H0(p,i.dimensions),g=Qn(i.impact)===l;return o(l,d,g,g,h,u)}if(i.phase==="DROP_ANIMATING"){let p=i.completed;if(!Og(c,p.critical))return e;let h=H0(p.critical,i.dimensions);return o(l,d,PT(p.result)===l,Qn(p.impact)===l,h,u)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){let p=i.completed;if(!Og(c,p.critical))return e;let h=Qn(p.impact)===l,g=!!(p.impact.at&&p.impact.at.type==="COMBINE"),m=p.critical.droppable.id===l;return h?g?t:e:m?t:e}return e}},gH={updateViewportMaxScroll:g2},Iu=mg(hH,gH,(t,e,n)=>({...UT(n),...t,...e}),{context:Qg,areStatePropsEqual:RT})(pH);ri();Se();ri();Se();function mH(){return new URLSearchParams(window.location.search).get("deeplink")||""}var KT=pt(null);function jT(t){let e=mH(),[n,o]=L(e),r={value:n,setValue:o};return F(()=>{o(e)},[e]),F(()=>{let i=s=>{if(mw(s.origin)&&zw(s.data)){let a=s.data.scrollToDeeplink.deepKey,l=document.getElementById(a);if(l){o(a),im(l,{behavior:"smooth",force:!0});let c=new URL(window.location.href);c.searchParams.set("deeplink",a),window.history.replaceState({},"",c.toString())}}};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}},[]),f(KT.Provider,{value:r,children:t.children})}function ac(){let t=ft(KT);if(!t)throw new Error("[useDeeplink()] DeeplinkContext not found, be sure to add <DeeplinkProvider>");return t}function _H(t){let e=t;for(;e&&e!==document.body;){let n=e.closest("details");if(n&&n.parentElement)n.open=!0,e=n.parentElement;else break}}function bH(t){let e=[],n=t;for(;n&&n!==document.body;){let o=n.closest(".DocEditor__ArrayField__item");if(!o)break;let r=o.querySelector(".DocEditor__ArrayField__item__header");if(r&&!e.includes(r))e.push(r),n=o.parentElement;else break}return e}function im(t,e={behavior:"auto"}){setTimeout(()=>{let n=document.querySelector(".DocumentPage__side");if(!n||n.scrollTop>0&&!e.force)return;_H(t);let r=bH(t).reduce((s,a)=>s+a.offsetHeight,0),i=t.offsetTop-r;n.scroll({top:i,behavior:e.behavior})},e.force?0:300)}function VT(t){let e=new URL(window.location.href);return e.searchParams.set("deeplink",t),e.toString()}var yH={get:async()=>{try{let t=await xH();return t?JSON.parse(t):null}catch{return null}},set:t=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(JSON.stringify(t,void 0,2)).catch(console.error)}};function sm(){return yH}async function xH(){try{if(navigator.clipboard&&navigator.clipboard.readText)return await navigator.clipboard.readText()}catch{}return null}function to(t,e){if(!CH())return;let n=vH();if(!n)return;let o={highlightNode:{deepKey:t,options:e}};n.contentWindow?.postMessage(o,window.location.origin)}function vH(){return document.querySelector('iframe[title="iframe preview"]')}function CH(){let t=window.__ROOT_CTX.preview||{};return[!0,"to-preview"].includes(t.channel)}function WT(t,e){return t.replace(/\{(.+?)\}/g,(n,o)=>{let r=e(o);return r??n})}var Au=class extends Error{};function GT(t,e,n){let o=t.preview?.title;if(o)return ga(o,e,n)}function YT(t,e,n){let o=t.preview?.image;if(o)return ga(o,e,n)}function ga(t,e,n){if(!t)return;let o=Array.isArray(t)?t:[t],r=n?.index,i=s=>{if(r!==void 0){if(s==="_index"||s==="_index0")return String(r);if(s==="_index1")return String(r+1);if(s==="_index:02")return String(r).padStart(2,"0");if(s==="_index:03")return String(r).padStart(3,"0")}let a=Yo(e,s);if(!a)throw new Au(s);if(Pd(a)){let l=EH(a);if(l)return l}return String(a)};for(let s of o)try{return WT(s,i)}catch(a){if(a instanceof Au)continue;throw a}}function EH(t){let e=t?.blocks||[];for(let n of e)if(n.type==="paragraph"){let o=n.data?.text||"";o=o.replace(/<br\s*\/?>/gi,`
82
+ `),o=o.replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ");let r=o.split(/\r?\n/)[0].trim();if(r)return r}}function as(t,e,n={}){if(e==null)return!0;switch(t.type){case"string":case"select":case"date":case"datetime":return e==="";case"multiselect":return!Array.isArray(e)||e.length===0;case"number":case"boolean":return e==null;case"image":case"file":return!e||!e.src;case"reference":return!e||!e.id;case"references":return!Array.isArray(e)||e.length===0;case"richtext":return!Pd(e);case"object":if(!Rn(e)||Object.keys(e).length===0)return!0;for(let o of t.fields||[])if(o.id&&!as(o,e[o.id],n))return!1;return!0;case"array":if(Array.isArray(e)){if(e.length===0)return!0;for(let o of e)if(!as(t.of,o,n))return!1;return!0}if(!Rn(e)||!Array.isArray(e._array)||e._array.length===0)return!0;for(let o of e._array)if(!as(t.of,e[o],n))return!1;return!0;case"oneof":{if(!Rn(e)||!e._type)return!0;let o,r=t.types||[];if(typeof r[0]=="string"?r.includes(e._type)&&(o=n[e._type]):o=r.find(i=>i.name===e._type),!o)return!0;for(let i of o.fields||[])if(i.id&&!as(i,e[i.id],n))return!1;return!0}default:return!1}}Se();function qT(t,e){let n=!1;return(...o)=>{n||(t(...o),n=!0,setTimeout(()=>{n=!1},e))}}var lc=class extends ho{constructor(n){super();this.interval=0;this.timeout=0;this.interval=n}start(){this.timeout=window.setTimeout(()=>{this.tick()},this.interval)}tick(){this.dispatch("tick"),this.start()}reset(){this.stop(),this.start()}stop(){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0)}};var wH=60*Zi.second,JT=5*Zi.minute,am=class extends ho{constructor(n){super();this.started=!1;this.timer=new lc(wH);this.idleTimer=new lc(JT);this.onUserInteraction=qT(()=>{this.idleTimer.reset()},5e3);this.id=n;let o=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db;this.docRef=Od(r,"Projects",o,"Viewers",n),this.timer.on("tick",()=>this.onTick()),this.idleTimer.on("tick",()=>this.onIdle()),window.addEventListener("mousemove",this.onUserInteraction),window.addEventListener("keypress",this.onUserInteraction)}async start(){this.started||(this.started=!0,this.dbUnsubscribe=Ad(this.docRef,n=>{let o=n.data();this.onData(o)}),this.onTick(),this.timer.start())}onData(n){let o=window.firebase.user,r=Dd.now(),i=Object.values(n).filter(s=>!(s.email===o.email||r.toMillis()-s.lastViewedAt.toMillis()>JT));this.dispatch("change",i)}async onTick(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}await AC(this.docRef,{[n.email]:{email:n.email,photoURL:n.photoURL,lastViewedAt:ea()}},{merge:!0})}async onIdle(){this.stop()}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.timer.stop(),this.idleTimer.stop(),this.onDisconnect(),this.started=!1)}async onDisconnect(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}let o=new IC(n.email,"disconnectedAt");await Id(this.docRef,o,ea())}async dispose(){super.dispose(),this.stop(),this.timer.dispose(),this.idleTimer.dispose()}};function XT(t){let e=LC(t.id),[n,o]=L([]);if(F(()=>{let l=new am(e);l.on("change",d=>o(d)),l.start();let c=()=>{document.hidden||document.visibilityState!=="visible"?l.stop():l.started||l.start()};return document.addEventListener("visibilitychange",c),()=>{l.dispose(),document.removeEventListener("visibilitychange",c)}},[e]),n.length===0)return null;function r(l){return l.disconnectedAt?l.disconnectedAt>l.lastViewedAt:!1}let i=t.max||3,s=n.slice(0,i),a=n.length-i;return f("div",{className:"Viewers",children:[s.map(l=>f(nw,{email:l.email,size:30,inactive:r(l),className:"Viewers__avatar"},l.email)),a>0&&f(SC,{className:"Viewers__avatar",size:30,radius:"xl",children:["+",a]})]})}function ZT(t){let n=t.field.checkboxLabel||"Enabled",[o,r]=It(t.deepKey,!1);return f("div",{className:"DocEditor__BooleanField",children:f(uo,{label:n,onChange:i=>{let s=i.currentTarget;r(s.checked)},checked:o,size:"xs"})})}Se();function QT(t){let[e,n]=It(t.deepKey),[o,r]=L(null),i=(s,a)=>{if(a&&!a.valid){r("Invalid date");return}if(s){let l=new Date(s);if(isNaN(l.getTime())){r("Invalid date");return}r(null),n(s)}else r(null),n(null)};return f("div",{className:"DocEditor__DateField",children:[f("input",{type:"date",value:e||"",onChange:s=>{let a=s.currentTarget;i(a.value,a.validity)}}),o&&f("div",{style:{color:"red",fontSize:"12px",marginTop:"4px"},children:o})]})}var TH={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},eS=(t,e,n)=>{let o,r=TH[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Mu(t){return(e={})=>{let n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}var SH={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},kH={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},NH={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tS={date:Mu({formats:SH,defaultWidth:"full"}),time:Mu({formats:kH,defaultWidth:"full"}),dateTime:Mu({formats:NH,defaultWidth:"full"})};var DH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},nS=(t,e,n,o)=>DH[t];function ma(t){return(e,n)=>{let o=n?.context?String(n.context):"standalone",r;if(o==="formatting"&&t.formattingValues){let s=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):s;r=t.formattingValues[a]||t.formattingValues[s]}else{let s=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;r=t.values[a]||t.values[s]}let i=t.argumentCallback?t.argumentCallback(e):e;return r[i]}}var OH={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},IH={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},AH={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},MH={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},RH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},PH=(t,e)=>{let n=Number(t),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},oS={ordinalNumber:PH,era:ma({values:OH,defaultWidth:"wide"}),quarter:ma({values:IH,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ma({values:AH,defaultWidth:"wide"}),day:ma({values:MH,defaultWidth:"wide"}),dayPeriod:ma({values:LH,defaultWidth:"wide",formattingValues:RH,defaultFormattingWidth:"wide"})};function _a(t){return(e,n={})=>{let o=n.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],i=e.match(r);if(!i)return null;let s=i[0],a=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?BH(a,u=>u.test(s)):FH(a,u=>u.test(s)),c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;let d=e.slice(s.length);return{value:c,rest:d}}}function FH(t,e){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function BH(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function rS(t){return(e,n={})=>{let o=e.match(t.matchPattern);if(!o)return null;let r=o[0],i=e.match(t.parsePattern);if(!i)return null;let s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;let a=e.slice(r.length);return{value:s,rest:a}}}var $H=/^(\d+)(th|st|nd|rd)?/i,zH=/\d+/i,HH={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},UH={any:[/^b/i,/^(a|c)/i]},KH={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},jH={any:[/1/i,/2/i,/3/i,/4/i]},VH={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},WH={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},GH={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},YH={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},qH={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},JH={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},iS={ordinalNumber:rS({matchPattern:$H,parsePattern:zH,valueCallback:t=>parseInt(t,10)}),era:_a({matchPatterns:HH,defaultMatchWidth:"wide",parsePatterns:UH,defaultParseWidth:"any"}),quarter:_a({matchPatterns:KH,defaultMatchWidth:"wide",parsePatterns:jH,defaultParseWidth:"any",valueCallback:t=>t+1}),month:_a({matchPatterns:VH,defaultMatchWidth:"wide",parsePatterns:WH,defaultParseWidth:"any"}),day:_a({matchPatterns:GH,defaultMatchWidth:"wide",parsePatterns:YH,defaultParseWidth:"any"}),dayPeriod:_a({matchPatterns:qH,defaultMatchWidth:"any",parsePatterns:JH,defaultParseWidth:"any"})};var lm={code:"en-US",formatDistance:eS,formatLong:tS,formatRelative:nS,localize:oS,match:iS,options:{weekStartsOn:0,firstWeekContainsDate:1}};var XH={};function Xo(){return XH}var ZH=Math.pow(10,8)*24*60*60*1e3,dX=-ZH,Lu=6048e5,sS=864e5;var QH=3600;var aS=QH*24,uX=aS*7,e4=aS*365.2425,t4=e4/12,pX=t4*3,cm=Symbol.for("constructDateFrom");function Pn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&cm in t?t[cm](e):t instanceof Date?new t.constructor(e):new Date(e)}function yt(t,e){return Pn(e||t,t)}function dm(t){let e=yt(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function lS(t,...e){let n=Pn.bind(null,t||e.find(o=>typeof o=="object"));return e.map(n)}function um(t,e){let n=yt(t,e?.in);return n.setHours(0,0,0,0),n}function cS(t,e,n){let[o,r]=lS(n?.in,t,e),i=um(o),s=um(r),a=+i-dm(i),l=+s-dm(s);return Math.round((a-l)/sS)}function dS(t,e){let n=yt(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function uS(t,e){let n=yt(t,e?.in);return cS(n,dS(n))+1}function Er(t,e){let n=Xo(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=yt(t,e?.in),i=r.getDay(),s=(i<o?7:0)+i-o;return r.setDate(r.getDate()-s),r.setHours(0,0,0,0),r}function ls(t,e){return Er(t,{...e,weekStartsOn:1})}function Ru(t,e){let n=yt(t,e?.in),o=n.getFullYear(),r=Pn(n,0);r.setFullYear(o+1,0,4),r.setHours(0,0,0,0);let i=ls(r),s=Pn(n,0);s.setFullYear(o,0,4),s.setHours(0,0,0,0);let a=ls(s);return n.getTime()>=i.getTime()?o+1:n.getTime()>=a.getTime()?o:o-1}function pS(t,e){let n=Ru(t,e),o=Pn(e?.in||t,0);return o.setFullYear(n,0,4),o.setHours(0,0,0,0),ls(o)}function fS(t,e){let n=yt(t,e?.in),o=+ls(n)-+pS(n);return Math.round(o/Lu)+1}function Pu(t,e){let n=yt(t,e?.in),o=n.getFullYear(),r=Xo(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=Pn(e?.in||t,0);s.setFullYear(o+1,0,i),s.setHours(0,0,0,0);let a=Er(s,e),l=Pn(e?.in||t,0);l.setFullYear(o,0,i),l.setHours(0,0,0,0);let c=Er(l,e);return+n>=+a?o+1:+n>=+c?o:o-1}function hS(t,e){let n=Xo(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=Pu(t,e),i=Pn(e?.in||t,0);return i.setFullYear(r,0,o),i.setHours(0,0,0,0),Er(i,e)}function gS(t,e){let n=yt(t,e?.in),o=+Er(n,e)-+hS(n,e);return Math.round(o/Lu)+1}function Ue(t,e){let n=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return n+o}var wr={y(t,e){let n=t.getFullYear(),o=n>0?n:1-n;return Ue(e==="yy"?o%100:o,e.length)},M(t,e){let n=t.getMonth();return e==="M"?String(n+1):Ue(n+1,2)},d(t,e){return Ue(t.getDate(),e.length)},a(t,e){let n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Ue(t.getHours()%12||12,e.length)},H(t,e){return Ue(t.getHours(),e.length)},m(t,e){return Ue(t.getMinutes(),e.length)},s(t,e){return Ue(t.getSeconds(),e.length)},S(t,e){let n=e.length,o=t.getMilliseconds(),r=Math.trunc(o*Math.pow(10,n-3));return Ue(r,e.length)}};var ba={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},pm={G:function(t,e,n){let o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});default:return n.era(o,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){let o=t.getFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return wr.y(t,e)},Y:function(t,e,n,o){let r=Pu(t,o),i=r>0?r:1-r;if(e==="YY"){let s=i%100;return Ue(s,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Ue(i,e.length)},R:function(t,e){let n=Ru(t);return Ue(n,e.length)},u:function(t,e){let n=t.getFullYear();return Ue(n,e.length)},Q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return Ue(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return Ue(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,e,n){let o=t.getMonth();switch(e){case"M":case"MM":return wr.M(t,e);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(t,e,n){let o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return Ue(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(t,e,n,o){let r=gS(t,o);return e==="wo"?n.ordinalNumber(r,{unit:"week"}):Ue(r,e.length)},I:function(t,e,n){let o=fS(t);return e==="Io"?n.ordinalNumber(o,{unit:"week"}):Ue(o,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):wr.d(t,e)},D:function(t,e,n){let o=uS(t);return e==="Do"?n.ordinalNumber(o,{unit:"dayOfYear"}):Ue(o,e.length)},E:function(t,e,n){let o=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Ue(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Ue(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,n){let o=t.getDay(),r=o===0?7:o;switch(e){case"i":return String(r);case"ii":return Ue(r,e.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(t,e,n){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){let o=t.getHours(),r;switch(o===12?r=ba.noon:o===0?r=ba.midnight:r=o/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){let o=t.getHours(),r;switch(o>=17?r=ba.evening:o>=12?r=ba.afternoon:o>=4?r=ba.morning:r=ba.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return wr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):wr.H(t,e)},K:function(t,e,n){let o=t.getHours()%12;return e==="Ko"?n.ordinalNumber(o,{unit:"hour"}):Ue(o,e.length)},k:function(t,e,n){let o=t.getHours();return o===0&&(o=24),e==="ko"?n.ordinalNumber(o,{unit:"hour"}):Ue(o,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):wr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):wr.s(t,e)},S:function(t,e){return wr.S(t,e)},X:function(t,e,n){let o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return _S(o);case"XXXX":case"XX":return cs(o);default:return cs(o,":")}},x:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"x":return _S(o);case"xxxx":case"xx":return cs(o);default:return cs(o,":")}},O:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+mS(o,":");default:return"GMT"+cs(o,":")}},z:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+mS(o,":");default:return"GMT"+cs(o,":")}},t:function(t,e,n){let o=Math.trunc(+t/1e3);return Ue(o,e.length)},T:function(t,e,n){return Ue(+t,e.length)}};function mS(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.trunc(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+Ue(i,2)}function _S(t,e){return t%60===0?(t>0?"-":"+")+Ue(Math.abs(t)/60,2):cs(t,e)}function cs(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Ue(Math.trunc(o/60),2),i=Ue(o%60,2);return n+r+e+i}var bS=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},yS=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},n4=(t,e)=>{let n=t.match(/(P+)(p+)?/)||[],o=n[1],r=n[2];if(!r)return bS(t,e);let i;switch(o){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",bS(o,e)).replace("{{time}}",yS(r,e))},xS={p:yS,P:n4};var o4=/^D+$/,r4=/^Y+$/,i4=["D","DD","YY","YYYY"];function vS(t){return o4.test(t)}function CS(t){return r4.test(t)}function ES(t,e,n){let o=s4(t,e,n);if(console.warn(o),i4.includes(t))throw new RangeError(o)}function s4(t,e,n){let o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function wS(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function TS(t){return!(!wS(t)&&typeof t!="number"||isNaN(+yt(t)))}var a4=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,l4=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,c4=/^'([^]*?)'?$/,d4=/''/g,u4=/[a-zA-Z]/;function SS(t,e,n){let o=Xo(),r=n?.locale??o.locale??lm,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,a=yt(t,n?.in);if(!TS(a))throw new RangeError("Invalid time value");let l=e.match(l4).map(d=>{let u=d[0];if(u==="p"||u==="P"){let p=xS[u];return p(d,r.formatLong)}return d}).join("").match(a4).map(d=>{if(d==="''")return{isToken:!1,value:"'"};let u=d[0];if(u==="'")return{isToken:!1,value:p4(d)};if(pm[u])return{isToken:!0,value:d};if(u.match(u4))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));let c={firstWeekContainsDate:i,weekStartsOn:s,locale:r};return l.map(d=>{if(!d.isToken)return d.value;let u=d.value;(!n?.useAdditionalWeekYearTokens&&CS(u)||!n?.useAdditionalDayOfYearTokens&&vS(u))&&ES(u,e,String(t));let p=pm[u[0]];return p(a,u,r.localize,c)}).join("")}function p4(t){let e=t.match(c4);return e?e[1].replace(d4,"'"):t}function kS(){return Object.assign({},Xo())}function fm(t,e,n){let o=kS(),r=g4(t,n.timeZone,n.locale??o.locale);return"formatToParts"in r?f4(r,e):h4(r,e)}function f4(t,e){let n=t.formatToParts(e);for(let o=n.length-1;o>=0;--o)if(n[o].type==="timeZoneName")return n[o].value}function h4(t,e){let n=t.format(e).replace(/\u200E/g,""),o=/ [\w-+ ]+$/.exec(n);return o?o[0].substr(1):""}function g4(t,e,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:e,timeZoneName:t})}function DS(t,e){let n=x4(e);return"formatToParts"in n?_4(n,t):b4(n,t)}var m4={year:0,month:1,day:2,hour:3,minute:4,second:5};function _4(t,e){try{let n=t.formatToParts(e),o=[];for(let r=0;r<n.length;r++){let i=m4[n[r].type];i!==void 0&&(o[i]=parseInt(n[r].value,10))}return o}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function b4(t,e){let n=t.format(e),o=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(o[3],10),parseInt(o[1],10),parseInt(o[2],10),parseInt(o[4],10),parseInt(o[5],10),parseInt(o[6],10)]}var hm={},NS=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),y4=NS==="06/25/2014, 00:00:00"||NS==="\u200E06\u200E/\u200E25\u200E/\u200E2014\u200E \u200E00\u200E:\u200E00\u200E:\u200E00";function x4(t){return hm[t]||(hm[t]=y4?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),hm[t]}function cc(t,e,n,o,r,i,s){let a=new Date(0);return a.setUTCFullYear(t,e,n),a.setUTCHours(o,r,i,s),a}var OS=36e5,v4=6e4,gm={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Tr(t,e,n){if(!t)return 0;let o=gm.timezoneZ.exec(t);if(o)return 0;let r,i;if(o=gm.timezoneHH.exec(t),o)return r=parseInt(o[1],10),IS(r)?-(r*OS):NaN;if(o=gm.timezoneHHMM.exec(t),o){r=parseInt(o[2],10);let s=parseInt(o[3],10);return IS(r,s)?(i=Math.abs(r)*OS+s*v4,o[1]==="+"?-i:i):NaN}if(w4(t)){e=new Date(e||Date.now());let s=n?e:C4(e),a=mm(s,t);return-(n?a:E4(e,a,t))}return NaN}function C4(t){return cc(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function mm(t,e){let n=DS(t,e),o=cc(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=t.getTime(),i=r%1e3;return r-=i>=0?i:1e3+i,o-r}function E4(t,e,n){let r=t.getTime()-e,i=mm(new Date(r),n);if(e===i)return e;r-=i-e;let s=mm(new Date(r),n);return i===s?i:Math.max(i,s)}function IS(t,e){return-23<=t&&t<=23&&(e==null||0<=e&&e<=59)}var AS={};function w4(t){if(AS[t])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:t}),AS[t]=!0,!0}catch{return!1}}var T4=60*1e3,LS={X:function(t,e,n){let o=_m(n.timeZone,t);if(o===0)return"Z";switch(e){case"X":return MS(o);case"XXXX":case"XX":return ya(o);default:return ya(o,":")}},x:function(t,e,n){let o=_m(n.timeZone,t);switch(e){case"x":return MS(o);case"xxxx":case"xx":return ya(o);default:return ya(o,":")}},O:function(t,e,n){let o=_m(n.timeZone,t);switch(e){case"O":case"OO":case"OOO":return"GMT"+S4(o,":");default:return"GMT"+ya(o,":")}},z:function(t,e,n){switch(e){case"z":case"zz":case"zzz":return fm("short",t,n);default:return fm("long",t,n)}}};function _m(t,e){let n=t?Tr(t,e,!0)/T4:e?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+t);return n}function Fu(t,e){let n=t<0?"-":"",o=Math.abs(t).toString();for(;o.length<e;)o="0"+o;return n+o}function ya(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Fu(Math.floor(o/60),2),i=Fu(Math.floor(o%60),2);return n+r+e+i}function MS(t,e){return t%60===0?(t>0?"-":"+")+Fu(Math.abs(t)/60,2):ya(t,e)}function S4(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.floor(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+Fu(i,2)}function bm(t){let e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+t-+e}var Bu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;var ym=36e5,RS=6e4,k4=2,vn={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Bu};function pi(t,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(t===null)return new Date(NaN);let n=e.additionalDigits==null?k4:Number(e.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]")return new Date(t.getTime());if(typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]")return new Date(t);if(Object.prototype.toString.call(t)!=="[object String]")return new Date(NaN);let o=N4(t),{year:r,restDateString:i}=D4(o.date,n),s=O4(i,r);if(s===null||isNaN(s.getTime()))return new Date(NaN);if(s){let a=s.getTime(),l=0,c;if(o.time&&(l=I4(o.time),l===null||isNaN(l)))return new Date(NaN);if(o.timeZone||e.timeZone){if(c=Tr(o.timeZone||e.timeZone,new Date(a+l)),isNaN(c))return new Date(NaN)}else c=bm(new Date(a+l)),c=bm(new Date(a+l+c));return new Date(a+l+c)}else return new Date(NaN)}function N4(t){let e={},n=vn.dateTimePattern.exec(t),o;if(n?(e.date=n[1],o=n[3]):(n=vn.datePattern.exec(t),n?(e.date=n[1],o=n[2]):(e.date=null,o=t)),o){let r=vn.timeZone.exec(o);r?(e.time=o.replace(r[1],""),e.timeZone=r[1].trim()):e.time=o}return e}function D4(t,e){if(t){let n=vn.YYY[e],o=vn.YYYYY[e],r=vn.YYYY.exec(t)||o.exec(t);if(r){let i=r[1];return{year:parseInt(i,10),restDateString:t.slice(i.length)}}if(r=vn.YY.exec(t)||n.exec(t),r){let i=r[1];return{year:parseInt(i,10)*100,restDateString:t.slice(i.length)}}}return{year:null}}function O4(t,e){if(e===null)return null;let n,o,r;if(!t||!t.length)return n=new Date(0),n.setUTCFullYear(e),n;let i=vn.MM.exec(t);if(i)return n=new Date(0),o=parseInt(i[1],10)-1,FS(e,o)?(n.setUTCFullYear(e,o),n):new Date(NaN);if(i=vn.DDD.exec(t),i){n=new Date(0);let s=parseInt(i[1],10);return L4(e,s)?(n.setUTCFullYear(e,0,s),n):new Date(NaN)}if(i=vn.MMDD.exec(t),i){n=new Date(0),o=parseInt(i[1],10)-1;let s=parseInt(i[2],10);return FS(e,o,s)?(n.setUTCFullYear(e,o,s),n):new Date(NaN)}if(i=vn.Www.exec(t),i)return r=parseInt(i[1],10)-1,BS(r)?PS(e,r):new Date(NaN);if(i=vn.WwwD.exec(t),i){r=parseInt(i[1],10)-1;let s=parseInt(i[2],10)-1;return BS(r,s)?PS(e,r,s):new Date(NaN)}return null}function I4(t){let e,n,o=vn.HH.exec(t);if(o)return e=parseFloat(o[1].replace(",",".")),xm(e)?e%24*ym:NaN;if(o=vn.HHMM.exec(t),o)return e=parseInt(o[1],10),n=parseFloat(o[2].replace(",",".")),xm(e,n)?e%24*ym+n*RS:NaN;if(o=vn.HHMMSS.exec(t),o){e=parseInt(o[1],10),n=parseInt(o[2],10);let r=parseFloat(o[3].replace(",","."));return xm(e,n,r)?e%24*ym+n*RS+r*1e3:NaN}return null}function PS(t,e,n){e=e||0,n=n||0;let o=new Date(0);o.setUTCFullYear(t,0,4);let r=o.getUTCDay()||7,i=e*7+n+1-r;return o.setUTCDate(o.getUTCDate()+i),o}var A4=[31,28,31,30,31,30,31,31,30,31,30,31],M4=[31,29,31,30,31,30,31,31,30,31,30,31];function $S(t){return t%400===0||t%4===0&&t%100!==0}function FS(t,e,n){if(e<0||e>11)return!1;if(n!=null){if(n<1)return!1;let o=$S(t);if(o&&n>M4[e]||!o&&n>A4[e])return!1}return!0}function L4(t,e){if(e<1)return!1;let n=$S(t);return!(n&&e>366||!n&&e>365)}function BS(t,e){return!(t<0||t>52||e!=null&&(e<0||e>6))}function xm(t,e,n){return!(t<0||t>=25||e!=null&&(e<0||e>=60)||n!=null&&(n<0||n>=60))}var R4=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function vm(t,e,n={}){e=String(e);let o=e.match(R4);if(o){let r=pi(n.originalDate||t,n);e=o.reduce(function(i,s){if(s[0]==="'")return i;let a=i.indexOf(s),l=i[a-1]==="'",c=i.replace(s,"'"+LS[s[0]](r,s,n)+"'");return l?c.substring(0,a-1)+c.substring(a+1):c},e)}return SS(t,e,n)}function Cm(t,e,n){t=pi(t,n);let o=Tr(e,t,!0),r=new Date(t.getTime()-o),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}function Em(t,e,n,o){return o={...o,timeZone:e,originalDate:t},vm(Cm(t,e,{timeZone:o.timeZone}),n,o)}function wm(t,e,n){if(typeof t=="string"&&!t.match(Bu))return pi(t,{...n,timeZone:e});t=pi(t,n);let o=cc(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).getTime(),r=Tr(e,new Date(o));return new Date(o+r)}Se();function zS(t){let e=t.field,[n,o]=It(t.deepKey),r=`${P4(t.deepKey)}.timezone`,[i,s]=It(r),a=e.timezone||i||Intl.DateTimeFormat().resolvedOptions().timeZone,l=X(()=>{if(!n)return"";try{return Em(n.toDate(),a,"yyyy-MM-dd'T'HH:mm")}catch(h){return console.error("Error formatting date:",h),""}},[n,a]),[c,d]=L(null),u=(h,g)=>{if(g&&!g.valid){console.warn("Invalid date input"),d("Invalid datetime");return}if(h)try{let m=wm(h,a);if(isNaN(m.getTime())){console.warn("Invalid date:",h),d("Invalid datetime");return}d(null),o(Dd.fromDate(m))}catch(m){console.error("Error parsing date:",m),d("Invalid datetime")}else d(null),o(null)},p=h=>{s(h)};return f("div",{className:"DocEditor__DateTimeField",children:[f("div",{className:"DocEditor__DateTimeField__row",children:[f("input",{type:"datetime-local",value:l,onChange:h=>{let g=h.target;u(g.value,g.validity)},className:"DocEditor__DateTimeField__input"}),e.timezone?f("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",e.timezone]}):f(Ln,{className:"DocEditor__DateTimeField__timezoneSelect",value:a,onChange:h=>{h&&p(h)},data:Intl.supportedValuesOf("timeZone"),searchable:!0,size:"xs"})]}),c&&f("div",{className:"DocEditor__DateTimeField__error",children:c})]})}function P4(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}ri();si();si();Se();var F4=["drive.google.com","docs.google.com"];function $u(t){try{let e=new URL(t);if(!F4.includes(e.hostname))return null;if(e.searchParams.has("id"))return e.searchParams.get("id");let n=e.pathname.split("/"),o=n.findIndex(r=>r==="d");if(o!==-1&&o<n.length-1)return n[o+1]}catch{return null}return null}async function HS(t,e){let n="https://www.googleapis.com/auth/drive.readonly";(!t.isLoggedIn()||!t.hasScope(n))&&await t.login({scopes:[n]});let o=window.gapi;if(!o||!o.client||!o.client.drive)throw new Error("Google Drive API not loaded");let r=o.auth.getToken()?.access_token;if(!r)throw new Error("No Google Drive access token found");let[i,s]=await Promise.all([o.client.drive.files.get({fileId:e,fields:"name,mimeType,size",supportsAllDrives:!0}),fetch(`https://www.googleapis.com/drive/v3/files/${e}?alt=media&supportsAllDrives=true`,{headers:{Authorization:`Bearer ${r}`}})]),a=i.result;if(!s.ok)throw new Error(`Failed to download file from Drive: ${s.statusText}`);let l=await s.blob();return new File([l],a.name,{type:a.mimeType})}Se();var B4=["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"],$4=["#25262b","#868e96","#fa5252","#e64980","#be4bdb","#7950f2","#4c6ef5","#228be6","#15aabf","#12b886","#40c057","#82c91e","#fab005","#fd7e14"];function US(t){let[e,n]=L("simple"),[o,r]=L(!1),[i,s]=L(!1),[a,l]=L(null),[c,d]=L(""),[u,p]=L(t.initialWidth||1600),[h,g]=L(t.initialHeight||900),[m,_]=L("16:9"),b=aw();async function y(){if(!c){ae({title:"Prompt required",message:"Please enter a prompt to generate an image.",color:"red"});return}r(!0);try{let E=await(await fetch("/cms/api/ai.generate_image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c,aspectRatio:m})})).json();if(E.success&&E.image)l(E.image);else throw new Error(E.error||"Failed to generate image")}catch(C){console.error(C),ae({title:"Generation failed",message:C.message||"Unknown error",color:"red"})}finally{r(!1)}}function v(C){C.preventDefault();let E=new FormData(C.target),k=parseInt(E.get("width"),10),T=parseInt(E.get("height"),10),w=E.get("backgroundColor"),S=E.get("label")||`${k}x${T}`,N=[];if(N.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${T}" viewBox="0 0 ${k} ${T}"><rect width="${k}" height="${T}" fill="${w}" />`),S){let P=k*.5/(S.length*.6);N.push(`<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-size="${P}" fill="#fff">${S}</text>`)}N.push("</svg>");let D=N.join(""),A=new TextEncoder().encode(D),R={src:`data:image/svg+xml;base64,${btoa(String.fromCharCode(...A))}`,filename:"placeholder.svg",width:k,height:T,alt:""};t.onSubmit(R)}async function x(){if(a){s(!0);try{let E=await(await fetch(a)).blob(),k=new File([E],"generated-image.png",{type:"image/png"}),{uploadFileToGCS:T}=await import("./gcs-ECSDFCIU.js"),w=await T(k),[S,N]=m.split(":").map(Number),D=1600,O=Math.round(D*N/S),A={...w,width:D,height:O,alt:c};t.onSubmit(A)}catch(C){console.error(C),ae({title:"Save failed",message:C.message||"Failed to upload image",color:"red"})}finally{s(!1)}}}return f(po,{gap:"md",children:[b&&f(kd,{value:e,onChange:C=>n(C),data:[{label:"Simple",value:"simple"},{label:f(fn,{gap:5,children:[f(ko,{size:16}),f("span",{children:"Generate with AI"})]}),value:"ai"}],fullWidth:!0}),e==="simple"?f("form",{onSubmit:v,children:[f(po,{gap:"xs",children:[f(Jn,{label:"Width",name:"width",type:"number",value:u,onChange:C=>p(parseInt(C.currentTarget.value,10)),"data-autofocus":!0}),f(Jn,{label:"Height",name:"height",type:"number",value:h,onChange:C=>g(parseInt(C.currentTarget.value,10))}),f(Jn,{name:"label",label:"Label",defaultValue:""}),f(kC,{name:"backgroundColor",label:"Background color",format:"hex",defaultValue:"#868e96",swatches:$4})]}),f(fn,{justify:"flex-end",mt:"md",children:f(Z,{variant:"filled",type:"submit",children:"Create"})})]}):f(po,{gap:"xs",children:[f(Ln,{label:"Aspect Ratio",data:B4,value:m,onChange:C=>_(C)}),f(bn,{label:"Prompt",placeholder:"Describe the image you want to generate...",minRows:3,value:c,onChange:C=>d(C.currentTarget.value),"data-autofocus":!0,required:!0}),a&&f(Qs,{src:a,alt:"Generated preview",height:200,fit:"contain"}),f(fn,{justify:"flex-end",mt:"md",children:[f(Z,{variant:"light",onClick:y,loading:o,disabled:i||!c,leftIcon:f(ko,{size:16}),children:o?"Generating...":"Preview"}),f(Z,{variant:"filled",onClick:x,loading:i,disabled:!a||o,children:i?"Saving...":"Save"})]})]})]})}var z4=["image/gif","image/jpeg","image/png","image/svg+xml","image/webp"],KS=pt(null),H4=vC(()=>import("./ImageEditorDialog-GGS4VFEA.js").then(t=>({default:t.ImageEditorDialog})));function dc(){let t=ft(KS);if(!t)throw new Error("useFileField() should be called within a <FileFieldContext.Provider>");return t}function U4(t){let{field:e,value:n,setValue:o,loadingState:r,setLoadingState:i}=t,s=wC(),a=J(null),[l,c]=L(!1),[d,u]=L(!1),[p,h]=L(!1),g=aa(),m=Tw(),_=t.allowEditing!==!1,[b,y]=L("hash"),[v,x]=L(null),[C,E]=L(!1),[k,T]=L(null),w=t.accept??e.exts??(t.variant==="image"?z4:[]),S=n?.alt||"",N=t.altDisabledByMetadata===!0,D=n?.altDisabled===!0,O=e.alt!==!1&&!N&&!D;async function A(re,ee,be){try{i("loading");let Fe=be?.namingMode||(e.preserveFilename?"clean":"hash"),dn=e.cacheControl||(Fe==="clean"?"no-cache":void 0),Be=await ai(re,{namingMode:Fe,checkExists:be?.checkExists??!1,cacheControl:dn});!Be.alt&&jS(Be.filename)&&S&&(Be.alt=S),ee&&(Be.originalSrc=ee),o(Be),i("complete"),x(null),T(null)}catch(Fe){console.error("upload failed"),console.error(Fe),i("error"),ae({title:"Upload failed",message:"Failed to upload: "+String(Fe),color:"red",autoClose:!1})}}async function I(){i("loading");try{let re=n?.gcsPath||n?.src;re&&await $C(re),o(null),i(null),ae({message:"File deleted from GCS",color:"green"})}catch(re){console.error(re),i("error"),ae({title:"Delete failed",message:String(re),color:"red"})}finally{u(!1)}}function R(){if(!_&&n?.src){u(!0);return}o(null)}async function $(re,ee){if(!re)return;if(x(null),T(null),E(!1),typeof re=="string"&&!ee?.as){let dn=$u(re);if(dn){try{if(!g.enabled){console.warn("Google API integration is not enabled for this project. Specify the `gapi` config in your root.config.ts to enable pasting from Google Drive URLs.");return}i("loading"),ae({message:"Downloading from Google Drive...",loading:!0,autoClose:!1,id:"gdrive-download"});let Be=await HS(g,dn);Ol("gdrive-download"),$(Be)}catch(Be){console.error(Be),i("error"),Ol("gdrive-download"),ae({title:"Google Drive import failed",message:Be.message||"Failed to download",color:"red"})}return}}ee?.as==="svg"&&typeof re=="string"&&(re=new File([new Blob([re],{type:"image/svg+xml"})],"untitled.svg",{type:"image/svg+xml"}));let be=re,Fe=Ih(be.name);if(w.length>0&&!w.some(dn=>dn.endsWith(Fe)||dn===`*/${Fe}`||dn==="*/*"||dn===be.type)){ae({title:"Invalid file type",message:`File type ${Fe} is not allowed.`,color:"red",autoClose:!0});return}if(b==="clean"&&t.showNamingOptions){i("loading");let Be=`${window.__ROOT_CTX.rootConfig.projectId}/uploads/${be.name}`;try{if(await zC(Be)){x(be),T(`https://storage.googleapis.com/${window.firebase.storage.app.options.storageBucket}/${Be}`),i(null);return}}catch(nn){console.warn("Failed to check file existence",nn)}}A(be,void 0,{namingMode:b})}function W(){a.current?.focus()}function P(){if(n?.src)if(Ah(n.src)){let re=document.createElement("a");re.href=HC(n.src),n.filename&&(re.download=n.filename),document.body.appendChild(re),re.click(),document.body.removeChild(re)}else window.open(n.src,"_blank")}function q(){let re=document.createElement("input");re.type="file",w.length>0&&(re.accept=w.join(",")),re.onchange=ee=>{let be=ee.target;be.files&&be.files.length>0&&$(be.files[0])},re.click(),re.remove()}function ce(){c(!0)}function rt(){h(!0)}async function Et(){let re=UC();if(n?.assetId)try{let ee=await jC(n.assetId);ee&&(re=ee.parent||"")}catch(ee){console.warn("failed to resolve linked asset folder:",ee)}m.open({accept:w,initialFolder:re,onSelect:ee=>{let be=VC(ee);!be.alt&&S&&(be.alt=S),o(be),i("complete")}})}function _t(){if(!n?.assetId)return;let re={...n};delete re.assetId,o(re)}function dt(re){n?.src&&o({...n,alt:re||""})}async function ut(){let re=n;if(re?.src){i("loading");try{let ee=await window.fetch("/cms/api/ai.generate_alt_text",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({imageUrl:re.src})}),be=await ee.json();if(!ee.ok||!be.success)throw new Error(be.error||"Failed to generate alt text");be.altText&&dt(be.altText)}catch(ee){ae({title:"Sorry, something went wrong.",message:ee.message||"Unknown error",color:"red",autoClose:!0})}finally{i("complete")}}}return f(KS.Provider,{value:{field:e,variant:t.variant,value:n,setValue:o,loadingState:r,removeFile:R,acceptedFileTypes:w,handleFile:$,focusDropZone:W,requestGenerateAltText:ut,requestFileUpload:q,requestFileDownload:P,requestPlaceholderModalOpen:ce,requestImageEditorOpen:rt,assetPickerEnabled:m.enabled,requestAssetPicker:Et,unlinkAsset:_t,showAltText:O,altText:S,setAltText:dt,altDisabledByMetadata:N,setAltDisabledByMetadata:t.setAltDisabledByMetadata,allowEditing:_},children:[f(Xi,{size:"sm",opened:l,onClose:()=>c(!1),title:"Placeholder image",centered:!0,overlayColor:s.colorScheme==="dark"?s.colors.dark[9]:s.colors.gray[2],children:f(US,{onSubmit:re=>{o(re),c(!1)}})}),f(Xi,{size:"sm",opened:d,onClose:()=>u(!1),title:"Delete file?",centered:!0,overlayColor:s.colorScheme==="dark"?s.colors.dark[9]:s.colors.gray[2],children:[f(pn,{size:"sm",mb:"lg",children:"Are you sure you want to delete this file from GCS? This action cannot be undone."}),f(fn,{grow:!0,spacing:"xs",children:[f(Z,{variant:"default",onClick:()=>u(!1),disabled:r==="loading",children:"Cancel"}),f(Z,{color:"red",onClick:I,loading:r==="loading",children:"Delete"})]})]}),p&&n?.src&&f(wd,{fallback:null,children:f(H4,{opened:p,onClose:()=>h(!1),src:n.src,originalSrc:n.originalSrc,filename:n.filename,initialWidth:parseInt(n.width),initialHeight:parseInt(n.height),onSave:re=>{A(re,n.originalSrc||n.src),h(!1)}},n.src)}),v?f("div",{className:"FileField__overwriteWarning",children:[f("div",{className:"FileField__overwriteWarning__header",children:f(pn,{size:"sm",color:"red",weight:700,children:"File already exists"})}),f(pn,{size:"sm",children:["A file named ",f("strong",{children:v.name})," already exists."]}),k&&f(pn,{size:"sm",className:"FileField__overwriteWarning__link",children:f("a",{href:k,target:"_blank",rel:"noopener noreferrer",children:["View existing file ",f(vr,{size:12})]})}),f("div",{className:"FileField__overwriteWarning__checkbox",children:f(uo,{label:"Confirm overwrite",checked:C,onChange:re=>E(re.currentTarget.checked)})}),f(fn,{grow:!0,spacing:"xs",className:"FileField__overwriteWarning__actions",children:[f(Z,{variant:"default",onClick:()=>{x(null),T(null),E(!1)},disabled:r==="loading",children:"Cancel"}),f(Z,{disabled:!C,onClick:()=>A(v,void 0,{namingMode:"clean"}),color:"red",loading:r==="loading",children:"Overwrite"})]})]}):f(ke,{children:[f("div",{className:xe("FileField",t.showNamingOptions&&"FileField--withOptions"),children:[f(Cn.Dropzone,{ref:a}),n?.src?f(Cn.Preview,{}):f(Cn.InvisibleDropzone,{children:f(Cn.Empty,{})})]}),t.showNamingOptions&&!n&&f("div",{className:"FileField__settings",style:{marginTop:8},children:f(Ln,{label:"File name options",size:"xs",itemComponent:K4,data:[{value:"hash",label:"Hash the file name",description:"The filename will be hashed so the file's original name won't be exposed."},{value:"hash-path",label:"Use a hashed path with the original file name",description:"Use the original file name, but put it inside a hashed directory."},{value:"clean",label:"Use the original file name only",description:"The file will be uploaded to the bucket as-is, without a hashed directory."}],value:b,onChange:re=>y(re||"hash"),disabled:r==="loading"||!!n})})]})]})}function Cn(t){let e=t.field,[n,o]=It(t.deepKey),[r,i]=L(null),s=V4(t.deepKey),[a,l]=It(s),c=a?.alt===!1,d=u=>{let p={...a||{}};u?p.alt=!1:delete p.alt,l(Object.keys(p).length===0?null:p)};return f(U4,{field:e,value:n,setValue:o,loadingState:r,setLoadingState:i,variant:t.variant,allowEditing:t.allowEditing,altDisabledByMetadata:c,setAltDisabledByMetadata:t.variant==="image"&&e.alt!==!1?d:void 0})}Cn.Preview=()=>{let t=dc(),[e,n]=L(!1),[o,r]=L(!1),i=No(),s=!!t.value?.width&&!!t.value?.height&&Number(t.value.width)>0&&Number(t.value.height)>0,a=t.value?.filename||"",l=Ml(a),c=yr(a)||l&&s,[d,u]=L(!c),p=J(t.value?.src);if(t.value?.src!==p.current){p.current=t.value?.src;let h=t.value?.filename||"",g=yr(h)||Ml(h)&&s;!g&&!d?u(!0):g&&d&&u(!1)}return t.value?.src?f("div",{className:"FileField__Preview",children:[f("div",{className:"FileField__Preview__InfoButton",children:[c&&f(De,{label:"Toggle file info",position:"top",withArrow:!0,children:f(Ae,{onClick:()=>u(h=>!h),size:"sm",variant:"outline",className:"FileField__Preview__InfoButton__Icon","aria-label":"Toggle file info",children:f(Fl,{size:16})})}),f(G,{classNames:{body:"FileField__Preview__Menu"},shadow:"sm",control:f(Ae,{variant:"outline",size:"sm",radius:"sm",c:"black",className:"FileField__Preview__InfoButton__Icon",children:f(ia,{size:16})}),children:[t.allowEditing&&f(ke,{children:[f(G.Label,{size:"sm",children:"REPLACE"}),f(G.Item,{icon:t.variant==="image"?f(zh,{size:16}):f(Pl,{size:16}),onClick:()=>t.requestFileUpload(),children:["Upload ",t.variant==="image"?"image":"file"]}),t.assetPickerEnabled&&f(G.Item,{icon:f(AE,{size:16}),onClick:()=>t.requestAssetPicker(),children:"Select from asset library"}),VS(t.acceptedFileTypes)&&f(G.Item,{disabled:!t.value?.src,icon:f($h,{size:16}),onClick:()=>{t.requestPlaceholderModalOpen()},children:"Placeholder image"}),yr(t.value?.src)&&!t.value?.src?.endsWith(".svg")&&f(G.Item,{disabled:!t.value?.src,icon:f(mE,{size:16}),closeMenuOnClick:!0,onClick:()=>{t.requestImageEditorOpen()},children:"Edit image"}),f(_r,{})]}),f(G.Item,{disabled:t.value?.src?.startsWith("data:"),onClick:()=>{t?.requestFileDownload()},icon:f(bE,{size:16}),children:"Download file"}),f(G.Item,{closeOnItemClick:!1,icon:f(Wd,{size:16}),onClick:()=>{r(!1);let h=t.value?.src||"";Ah(h)&&(h=h.split("=")[0]+"=s0"),navigator.clipboard.writeText(h).then(()=>r(!0)).finally(()=>setTimeout(()=>{r(!1)},2e3))},children:o?"Copied!":"Copy URL"}),t.value?.assetId&&f(G.Item,{component:"a",href:`/cms/assets?asset=${t.value.assetId}`,target:"_blank",rel:"noreferrer",icon:f(vr,{size:16}),children:"View in asset library"}),t.allowEditing&&t.value?.assetId&&f(G.Item,{icon:f(YE,{size:16}),onClick:()=>t.unlinkAsset(),children:"Unlink from asset library"}),t.allowEditing&&yr(t.value?.src||"")&&t.value?.canvasBgColor&&f(G.Item,{icon:t.value?.canvasBgColor==="dark"?f(Vh,{size:16}):f(Kh,{size:16,style:{opacity:.25}}),closeOnItemClick:!1,onClick:()=>{let h=t.value?.canvasBgColor==="dark"?"light":"dark";t.value&&t.setValue({...t.value,canvasBgColor:h})},children:"Use dark canvas"}),t.allowEditing&&t.setAltDisabledByMetadata&&f(G.Item,{icon:t.altDisabledByMetadata?f(Vh,{size:16}):f(Kh,{size:16,style:{opacity:.25}}),closeOnItemClick:!1,onClick:()=>{t.setAltDisabledByMetadata?.(!t.altDisabledByMetadata)},children:"Disable alt text"}),f(_r,{}),f(G.Item,{color:"red",onClick:()=>{t?.removeFile()},icon:f(Xn,{size:16}),children:"Remove file"})]})]}),f("div",{className:xe("FileField__Canvas",d&&"FileField__Canvas--infoOpened",e&&"dragging"),style:j4(t.value),onDragOver:h=>{h.preventDefault(),n(!0)},onDragLeave:h=>{h.preventDefault(),n(!1)},onDrop:h=>{h.preventDefault(),n(!1);let g=h.dataTransfer?.files[0];g&&t&&t.handleFile(g)},onPaste:h=>{h.preventDefault();let g=h.clipboardData?.files[0];if(g){t.handleFile(g);return}let m=h.clipboardData?.getData("text/plain");if(m){if($u(m)){t.handleFile(m);return}if(WS(m)){t.handleFile(m,{as:"svg"});return}}},children:[f(Sd,{visible:t.loadingState==="loading"}),d?f("div",{className:"FileField__Canvas__Info",children:[f(Bl,{size:16,className:"FileField__Canvas__Info__Icon"}),f(OC,{className:"FileField__Canvas__Info__Table",verticalSpacing:"xs",fontSize:"xs",children:f("tbody",{children:[t.value?.filename&&f("tr",{children:[f("td",{children:f("b",{children:"Name"})}),f("td",{children:t.value.filename})]}),t.value?.assetId&&f("tr",{children:[f("td",{children:f("b",{children:"Asset"})}),f("td",{children:f("a",{href:`/cms/assets?asset=${t.value.assetId}`,target:"_blank",rel:"noreferrer",children:"Open in asset library"})})]}),t.value?.uploadedAt&&f("tr",{children:[f("td",{children:f("b",{children:"Uploaded"})}),f("td",{children:[new Date(parseInt(t.value.uploadedAt,10)).toLocaleString(),t.value.uploadedBy&&f(ke,{children:[" by ",t.value.uploadedBy]})]})]}),!!(t.value?.width&&t.value?.height)&&f("tr",{children:[f("td",{children:f("b",{children:"Dimensions"})}),f("td",{children:[t.value.width,"x",t.value.height]})]}),f("tr",{children:[f("td",{children:f("b",{children:"URL"})}),f("td",{children:f(bn,{readOnly:!0,value:t.value?.src,size:"xs",radius:0,autosize:!0,maxRows:10})})]})]})})]}):f(ke,{children:[!!(t.value?.width&&t.value?.height)&&f(TC,{radius:"sm",className:"FileField__Preview__Info",children:[t.value.width,"x",t.value.height]}),t.value?.assetId&&f("a",{className:"FileField__Preview__AssetLibraryBadge",href:`/cms/assets?asset=${t.value?.assetId}`,target:"_blank",children:"ASSET LIBRARY"}),yr(t.value?.src)&&f("img",{onClick:()=>{t?.focusDropZone()},onDblClick:()=>{t.allowEditing&&t?.requestFileUpload()},src:t.value.src,alt:t.value.alt||"Uploaded file preview",className:"FileField__Preview__Image"}),Ml(t.value?.src)&&f(ke,{children:f("video",{className:"FileField__Preview__Image",controls:!0,muted:!0,preload:"metadata",children:f("source",{src:t.value.src,type:`video/${Ih(t.value.src)}`})})})]}),t.allowEditing&&f("div",{className:"FileField__reupload",children:f(Cn.UploadButton,{className:"FileField__reupload__button",compact:!0})})]}),t.allowEditing&&t.showAltText&&(t.altText||jS(t.value?.filename)||t.variant==="image")&&f("div",{className:"DocEditor__ImageField__imagePreview__Image__Alt",children:[f(bn,{radius:0,className:"DocEditor__ImageField__imagePreview__Image__Alt__Textarea",value:t.altText,placeholder:"Alt text",size:"xs",autosize:!0,disabled:t.loadingState==="loading",onChange:h=>{t?.setAltText(h.currentTarget.value)}}),i&&!t.altText&&t.value?.src?.startsWith("http")&&f(De,{label:"Generate alt text with AI",position:"top",withArrow:!0,children:f(Ae,{className:"DocEditor__ImageField__imagePreview__Image__Alt__AiButton",onClick:()=>{t.requestGenerateAltText()},disabled:t.loadingState==="loading",children:f(ko,{size:20,stroke:"1.75"})})})]})]}):null};Cn.UploadButton=t=>{let e=dc(),n=e.loadingState==="loading",o=t.compact?14:16;return f(Z,{color:"black",variant:"default",disabled:n,size:t.compact?"compact-xs":"compact-md",className:xe("FileField__FileUploadButton",t.compact&&"FileField__FileUploadButton--compact"),onClick:()=>{e.requestFileUpload()},leftIcon:f(ke,{children:n&&!t.compact?f(Ft,{size:o}):e?.variant==="image"?f(zh,{size:o}):f(Pl,{size:o})}),children:n&&!t.compact?"Uploading...":e.value?.src?"Upload":"Paste, drop, or click to upload"})};Cn.InvisibleDropzone=t=>{let[e,n]=L(!1),o=dc();return f("div",{className:xe("FileField__InvisibleDropzone",e&&"dragging"),onDragOver:r=>{r.preventDefault(),r.stopPropagation(),n(!0)},onDragLeave:r=>{r.preventDefault(),r.stopPropagation(),n(!1)},onDrop:r=>{r.preventDefault(),r.stopPropagation(),n(!1);let i=r.dataTransfer?.files[0];i&&o.handleFile(i)},children:t.children})};Cn.Empty=()=>{let t=dc(),e=X(()=>{if(t.acceptedFileTypes.length===0)return"";let n=t.acceptedFileTypes.filter(o=>o!=="*/*"&&o!=="*");return n.length===0?"":n.map(o=>o.split("/").pop().split("+")[0].replaceAll(".","")).sort().join(", ")},[t.acceptedFileTypes]);return f("div",{className:"FileField__Empty",children:[f("div",{className:"FileField__Empty__Label",children:[f(Cn.UploadButton,{}),VS(t.acceptedFileTypes)&&f("div",{children:f(De,{label:"Create placeholder image",children:f(Ae,{className:"FileField__Empty__Label__PlaceholderButton",onClick:()=>{t.requestPlaceholderModalOpen()},title:"Create placeholder image",children:f($h,{size:16})})})})]}),t.allowEditing&&t.assetPickerEnabled&&f("div",{className:"FileField__Empty__AssetLibrary",children:["or select from"," ",f("button",{type:"button",className:"FileField__Empty__AssetLibrary__link",onClick:()=>t.requestAssetPicker(),children:"asset library"})]}),e&&f("div",{children:f("div",{className:"FileField__Empty__AcceptTypes",children:["Allowed file types: ",e]})})]})};Cn.Dropzone=Go((t,e)=>{let[n,o]=L(!1),r=dc();return f("button",{ref:e,className:xe("FileField__Dropzone",n&&"dragging"),onDblClick:()=>{r?.requestFileUpload()},onCopy:i=>{r.value?.src&&(i.preventDefault(),i.clipboardData?.setData("text/plain",r.value.src),i.clipboardData?.setData("application/json",JSON.stringify(r.value)))},onKeyDown:i=>{((i.metaKey||i.ctrlKey)&&i.key==="Backspace"||i.key==="Delete")&&(i.preventDefault(),r.value?.src&&r.removeFile())},onDragOver:i=>{i.preventDefault(),o(!0)},onDragLeave:i=>{i.preventDefault(),o(!1)},onDrop:i=>{i.preventDefault(),o(!1);let s=i.dataTransfer?.files[0];s&&r&&r.handleFile(s)},onPaste:i=>{if(i.preventDefault(),!r)return;let s=i.clipboardData?.getData("application/json");if(s)try{let c=JSON.parse(s);if(c&&c.src&&c.filename&&r){console.log("Parsed JSON file:",c),r.setValue(c);return}}catch(c){console.error("error parsing json",c)}let a=i.clipboardData?.files[0];if(a){r.handleFile(a);return}let l=i.clipboardData?.getData("text/plain");if(l){if($u(l)){r.handleFile(l);return}if(WS(l)){r.handleFile(l,{as:"svg"});return}}},title:"Drop or paste to upload a file"})});var K4=Go(t=>{let{label:e,description:n,...o}=t;return f("div",{className:"FileField__NamingModeItem",...o,children:[f(pn,{size:"sm",weight:500,children:e}),f(pn,{size:"xs",color:"dimmed",children:n})]})});function jS(t){return t?yr(t)||Ml(t):!1}function VS(t){return t.some(e=>e.startsWith("image/"))||t.length===0}function j4(t){let e={};if(t.width&&t.height){e["--canvas-aspect-ratio"]=`${t.width} / ${t.height}`,e["--canvas-asset-width"]=`${t.width}px`;let n=Math.min(t.height,280);n<80&&(n=80),e["--canvas-max-height"]=`${n}px`}return t.canvasBgColor==="dark"&&(e["--canvas-bg-color"]="#000"),e}function V4(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}function WS(t){return/^(?:\uFEFF)?\s*(?:<!--[\s\S]*?-->\s*)*(?:<\?xml[\s\S]*?\?>\s*)?(?:<!DOCTYPE\s+svg[\s\S]*?>\s*)?<svg\b[^>]*?(?:\/>|>[\s\S]*?<\/svg>)\s*$/.test(t)}function GS(t){return f(Cn,{...t,variant:"image"})}Se();function YS(t){let e=t.field,[n,o]=It(t.deepKey,[]),r=X(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return f("div",{className:"DocEditor__MultiSelectField",children:f(NC,{data:r,size:"xs",radius:0,placeholder:e.placeholder,value:n,searchable:!0,creatable:e.creatable||!1,getCreateLabel:i=>`+ Add "${i}"`,onChange:i=>o(i),dropdownComponent:"div"})})}function qS(t){let[e,n]=It(t.deepKey,0);return f(DC,{size:"xs",radius:0,value:e,onChange:o=>n(o),hideControls:!0})}Se();var JS="ReferenceFieldEditorModal";function zu(){let t=wt(),e=ot();return{open:n=>{t.openContextModal(JS,{...e,className:"ReferenceFieldEditorModalWrap",innerProps:n,title:`Edit ${n.docId}`,size:"xl",overflow:"inside",closeOnClickOutside:!1,closeOnEscape:!1})}}}function Tm(t){let{id:e,context:n,innerProps:o}=t,r=o.docId;return f("div",{className:"ReferenceFieldEditorModal",children:f(jw,{docId:r,autoSave:!1,flushOnStop:!1,children:[f(Ie,{className:"ReferenceFieldEditorModal__DocEditor",docId:o.docId,hideStatusBar:!0}),f(Tm.Footer,{docId:r,onCancel:()=>n.closeModal(e)})]})})}Tm.Footer=t=>{let e=rn();return f("div",{className:"ReferenceFieldEditorModal__footer",children:[f("div",{className:"ReferenceFieldEditorModal__footer__start",children:f(Z,{component:"a",variant:"default",size:"xs",rightIcon:f(ra,{size:16}),href:`/cms/content/${t.docId}`,target:"_blank",children:["Open ",t.docId]})}),f(Z,{variant:"default",size:"xs",onClick:t.onCancel,children:"Cancel"}),f(Z,{color:"dark",size:"xs",onClick:async()=>{await e.controller.flush(),t.onCancel()},children:"Save"})]})};Tm.id=JS;function xa(t){let e=t.field,[n,o]=It(t.deepKey),r=n?.id||"";function i(c){o(c?$d(c):null)}let s=au(),a=zu();function l(){let c=r?$d(r).collection:e.initialCollection;s.open({collections:e.collections,initialCollection:c,onChange:d=>{i(d),s.close()}})}return f("div",{className:"ReferenceField",children:[r?f("div",{className:"ReferenceField__ref",children:[f(xa.Preview,{id:r}),f("div",{className:"ReferenceField__remove",children:[f(De,{label:"Quick edit",children:f(Ae,{className:"ReferenceField__remove__icon",onClick:()=>a.open({docId:r}),children:f(Xd,{size:16})})}),f(De,{label:"Remove",children:f(Ae,{className:"ReferenceField__remove__icon",onClick:()=>o(null),children:f(Xn,{size:16})})})]})]}):f("div",{className:"ReferenceField__none",children:"None selected"}),f(Z,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}xa.Preview=t=>{let[e,n]=L(!0),[o,r]=L(null);async function i(){n(!0),await br(async()=>{let s=await Al(t.id);r(s)}),n(!1)}return F(()=>{i()},[t.id]),f("div",{className:"ReferenceField__Preview",children:e?f("div",{className:"ReferenceField__Preview__loading",children:f(Ft,{color:"gray",size:"sm"})}):o?f(xa.DocCard,{doc:o}):f("div",{className:"ReferenceField__Preview__notfound",children:["Doc not found: ",f("b",{children:t.id})," (was it deleted?). Select a new doc or remove using the trash icon to the right."]})})};xa.DocCard=t=>{let e=t.doc,n=e.id||e.sys?.id||"";if(!n)return f("div",{className:"ReferenceField__DocCard ReferenceField__DocCard--error",children:JSON.stringify(e)});let o=$d(n).collection,r=e.fields||{},i=window.__ROOT_CTX.collections[o];if(!i)throw new Error(`could not find collection: ${o}`);let s=Yo(r,i.preview?.title||"meta.title"),a=Yo(r,i.preview?.image||"meta.image")||i.preview?.defaultImage;return f("a",{className:"ReferenceField__DocCard",href:`/cms/content/${n}`,target:"_blank",children:[f("div",{className:"ReferenceField__DocCard__image",children:f(Qs,{src:a?.src,width:80,height:60,withPlaceholder:!a?.src})}),f("div",{className:"ReferenceField__DocCard__content",children:[f("div",{className:"ReferenceField__DocCard__content__header",children:f("div",{className:"ReferenceField__DocCard__content__header__docId",children:n})}),f("div",{className:"ReferenceField__DocCard__content__title",children:s||"[UNTITLED]"})]})]})};Se();function XS(t){let e=t.field,[n,o]=L([]),r=rn().controller;function i(d){if(d.length){let u=d.map(p=>{let[h,g]=p.split("/");return{id:p,collection:h,slug:g}});r.updateKey(t.deepKey,u)}else r.removeKey(t.deepKey);o(d)}Jo(t.deepKey,d=>{Array.isArray(d)?o(d.map(u=>u.id)):o([])});let s=au(),a=zu();function l(){s.open({collections:e.collections,initialCollection:e.initialCollection,multiSelect:!0,selectedDocIds:n,onChangeMulti:(d,u)=>{o(p=>{let h=[...p];if(u)h.includes(d)||h.push(d);else{let g=h.indexOf(d);g>-1&&h.splice(g,1)}return i(h),h})}})}function c(d){let u=n.filter(p=>p!==d);i(u)}return f("div",{className:"ReferencesField",children:[n.length>0?f(Du,{onDragEnd:d=>{let{destination:u,source:p}=d;if(!u||u.index===p.index)return;let h=[...n],[g]=h.splice(p.index,1);h.splice(u.index,0,g),i(h)},children:f(Iu,{droppableId:"ReferencesField__droppable",direction:"vertical",children:d=>f("div",{ref:d.innerRef,...d.droppableProps,className:"ReferencesField__refs",children:[n.map((u,p)=>f(Ou,{draggableId:u,index:p,children:(h,g)=>f("div",{ref:h.innerRef,...h.draggableProps,className:xe("ReferencesField__card",g.isDragging&&"ReferencesField__card--dragging"),children:[f("div",{className:"ReferencesField__card__handle",...h.dragHandleProps,children:f(Gd,{size:16,stroke:"1.5"})}),f(Hd,{className:"ReferencesField__card__preview",docId:u,variant:"compact",clickable:!0,statusBadges:!0}),f("div",{className:"ReferencesField__card__controls",children:[f(De,{label:"Quick edit",children:f(Ae,{onClick:()=>a.open({docId:u}),children:f(Xd,{size:16})})}),f(De,{label:"Remove",children:f(Ae,{className:"ReferencesField__card__controls__remove",onClick:()=>c(u),children:f(Xn,{size:16})})})]})]})},u)),d.placeholder]})})}):f("div",{className:"ReferencesField__none",children:"None selected"}),f(Z,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}Se();(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var _c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function W4(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}),n}function Sm(){}Object.assign(Sm,{default:Sm,register:Sm,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){let e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;for(;--n>=0&&e.item(n)!==this;);return n>-1});Element.prototype.closest||(Element.prototype.closest=function(t){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(t){let e=document.createDocumentFragment();Array.isArray(t)||(t=[t]),t.forEach(n=>{let o=n instanceof Node;e.appendChild(o?n:document.createTextNode(n))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(t){t=arguments.length===0?!0:!!t;let e=this.parentNode,n=window.getComputedStyle(e,null),o=parseInt(n.getPropertyValue("border-top-width")),r=parseInt(n.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,s=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,a=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-r>e.scrollLeft+e.clientWidth,c=i&&!s;(i||s)&&t&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(a||l)&&t&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-r+this.clientWidth/2),(i||s||a||l)&&!t&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(t){let e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)};var G4=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),""),uk=(t=>(t.VERBOSE="VERBOSE",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t))(uk||{}),we={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},Y4={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function Tc(t,e,n="log",o,r="color: inherit"){if(!("console"in window)||!window.console[n])return;let i=["info","log","warn","error"].includes(n),s=[];switch(Tc.logLevel){case"ERROR":if(n!=="error")return;break;case"WARN":if(!["error","warn"].includes(n))return;break;case"INFO":if(!i||t)return;break}o&&s.push(o);let a="Editor.js 2.31.0-rc.7";t&&(i?(s.unshift(`line-height: 1em;
83
+ color: #006FEA;
84
+ display: inline-block;
85
+ font-size: 11px;
86
+ line-height: 1em;
87
+ background-color: #fff;
88
+ padding: 4px 9px;
89
+ border-radius: 30px;
90
+ border: 1px solid rgba(56, 138, 229, 0.16);
91
+ margin: 4px 5px 4px 0;`,r),e=`%c${a}%c ${e}`):e=`( ${a} )${e}`);try{i?o?console[n](`${e} %o`,...s):console[n](e,...s):console[n](e)}catch{}}Tc.logLevel="VERBOSE";function q4(t){Tc.logLevel=t}var We=Tc.bind(window,!1),xo=Tc.bind(window,!0);function us(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function ht(t){return us(t)==="function"||us(t)==="asyncfunction"}function an(t){return us(t)==="object"}function Dr(t){return us(t)==="string"}function J4(t){return us(t)==="boolean"}function ZS(t){return us(t)==="number"}function QS(t){return us(t)==="undefined"}function vo(t){return t?Object.keys(t).length===0&&t.constructor===Object:!0}function pk(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}async function X4(t,e=()=>{},n=()=>{}){async function o(r,i,s){try{await r.function(r.data),await i(QS(r.data)?{}:r.data)}catch{s(QS(r.data)?{}:r.data)}}return t.reduce(async(r,i)=>(await r,o(i,e,n)),Promise.resolve())}function fk(t){return Array.prototype.slice.call(t)}function Yu(t,e){return function(){let n=this,o=arguments;window.setTimeout(()=>t.apply(n,o),e)}}function Z4(t){return t.name.split(".").pop()}function Q4(t){return/^[-\w]+\/([-+\w]+|\*)$/.test(t)}function ek(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=null,n||t.apply(i,r)},a=n&&!o;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function Mm(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s||(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s||(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}function e5(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e&&(t[e]=!0),t}function qu(t){return t[0].toUpperCase()+t.slice(1)}function Lm(t,...e){if(!e.length)return t;let n=e.shift();if(an(t)&&an(n))for(let o in n)an(n[o])?(t[o]||Object.assign(t,{[o]:{}}),Lm(t[o],n[o])):Object.assign(t,{[o]:n[o]});return Lm(t,...e)}function A_(t){let e=e5();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi," + "),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function t5(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function n5(){return G4(10)}function o5(t){window.open(t,"_blank")}function r5(t=""){return`${t}${Math.floor(Math.random()*1e8).toString(16)}`}function Rm(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&xo(o,"warn")}function Sa(t,e,n){let o=n.value?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,...s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}var hk=650;function ka(){return window.matchMedia(`(max-width: ${hk}px)`).matches}var Pm=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function i5(t,e){let n=Array.isArray(t)||an(t),o=Array.isArray(e)||an(e);return n||o?JSON.stringify(t)===JSON.stringify(e):t===e}var U=class t{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,n=null,o={}){let r=document.createElement(e);if(Array.isArray(n)){let i=n.filter(s=>s!==void 0);r.classList.add(...i)}else n&&r.classList.add(n);for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i]);return r}static text(e){return document.createTextNode(e)}static append(e,n){Array.isArray(n)?n.forEach(o=>e.appendChild(o)):e.appendChild(n)}static prepend(e,n){Array.isArray(n)?(n=n.reverse(),n.forEach(o=>e.prepend(o))):e.prepend(n)}static swap(e,n){let o=document.createElement("div"),r=e.parentNode;r.insertBefore(o,e),r.insertBefore(e,n),r.insertBefore(n,o),r.removeChild(o)}static find(e=document,n){return e.querySelector(n)}static get(e){return document.getElementById(e)}static findAll(e=document,n){return e.querySelectorAll(n)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return fk(e.querySelectorAll(t.allInputsSelector)).reduce((n,o)=>t.isNativeInput(o)||t.containsOnlyInlineElements(o)?[...n,o]:[...n,...t.getDeepestBlockElements(o)],[])}static getDeepestNode(e,n=!1){let o=n?"lastChild":"firstChild",r=n?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(t.isSingleTag(i)&&!t.isNativeInput(i)&&!t.isLineBreakTag(i))if(i[r])i=i[r];else if(i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return this.getDeepestNode(i,n)}return e}static isElement(e){return ZS(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return ZS(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){let n=["INPUT","TEXTAREA"];return e&&e.tagName?n.includes(e.tagName):!1}static canSetCaret(e){let n=!0;if(t.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":n=!1;break}else n=t.isContentEditable(e);return n}static isNodeEmpty(e,n){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("\u200B",""),n&&(o=o.replace(new RegExp(n,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,n){let o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,n))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){let n=t.make("div");return n.innerHTML=e,n.childElementCount>0}static getContentLength(e){return t.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let n;Dr(e)?(n=document.createElement("div"),n.innerHTML=e):n=e;let o=r=>!t.blockElements.includes(r.tagName.toLowerCase())&&Array.from(r.children).every(o);return Array.from(n.children).every(o)}static getDeepestBlockElements(e){return t.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((n,o)=>[...n,...t.getDeepestBlockElements(o)],[])}static getHolder(e){return Dr(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){let n=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=n.top+r,s=n.left+o;return{top:i,left:s,bottom:i+n.height,right:s+n.width}}};function s5(t){return!/[^\t\n\r ]/.test(t)}function a5(t){let e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2;return s+i+r+l+a}function gk(t){t.dataset.empty=U.isEmpty(t)?"true":"false"}var l5={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},c5={Text:"",Link:"",Bold:"",Italic:""},d5={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},u5={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},mk={ui:l5,toolNames:c5,tools:d5,blockTunes:u5},_k=class va{static ui(e,n){return va._t(e,n)}static t(e,n){return va._t(e,n)}static setDictionary(e){va.currentDictionary=e}static _t(e,n){let o=va.getNamespace(e);return!o||!o[n]?n:o[n]}static getNamespace(e){return e.split(".").reduce((n,o)=>!n||!Object.keys(n).length?{}:n[o],va.currentDictionary)}};_k.currentDictionary=mk;var wn=_k,Ju=class extends Error{},ps=class{constructor(){this.subscribers={}}on(e,n){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(n)}once(e,n){e in this.subscribers||(this.subscribers[e]=[]);let o=r=>{let i=n(r),s=this.subscribers[e].indexOf(o);return s!==-1&&this.subscribers[e].splice(s,1),i};this.subscribers[e].push(o)}emit(e,n){vo(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,r)=>{let i=r(o);return i!==void 0?i:o},n)}off(e,n){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===n){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}};function Sr(t){Object.setPrototypeOf(this,{get id(){return t.id},get name(){return t.name},get config(){return t.config},get holder(){return t.holder},get isEmpty(){return t.isEmpty},get selected(){return t.selected},set stretched(e){t.stretched=e},get stretched(){return t.stretched},get focusable(){return t.focusable},call(e,n){return t.call(e,n)},save(){return t.save()},validate(e){return t.validate(e)},dispatchChange(){t.dispatchChange()},getActiveToolboxEntry(){return t.getActiveToolboxEntry()}})}var fs=class{constructor(){this.allListeners=[]}on(e,n,o,r=!1){let i=r5("l"),s={id:i,element:e,eventType:n,handler:o,options:r};if(!this.findOne(e,n,o))return this.allListeners.push(s),e.addEventListener(n,o,r),i}off(e,n,o,r){let i=this.findAll(e,n,o);i.forEach((s,a)=>{let l=this.allListeners.indexOf(i[a]);l>-1&&(this.allListeners.splice(l,1),s.element.removeEventListener(s.eventType,s.handler,s.options))})}offById(e){let n=this.findById(e);n&&n.element.removeEventListener(n.eventType,n.handler,n.options)}findOne(e,n,o){let r=this.findAll(e,n,o);return r.length>0?r[0]:null}findAll(e,n,o){let r,i=e?this.findByEventTarget(e):[];return e&&n&&o?r=i.filter(s=>s.eventType===n&&s.handler===o):e&&n?r=i.filter(s=>s.eventType===n):r=i,r}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(n=>{if(n.element===e)return n})}findByType(e){return this.allListeners.filter(n=>{if(n.eventType===e)return n})}findByHandler(e){return this.allListeners.filter(n=>{if(n.handler===e)return n})}findById(e){return this.allListeners.find(n=>n.id===e)}},Le=class t{constructor({config:e,eventsDispatcher:n}){if(this.nodes={},this.listeners=new fs,this.readOnlyMutableListeners={on:(o,r,i,s=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,r,i,s))},clearAll:()=>{for(let o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===t)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=n}set state(e){this.Editor=e}removeAllNodes(){for(let e in this.nodes){let n=this.nodes[e];n instanceof HTMLElement&&n.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},_e=class t{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){let e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return n?U.isElement(n)?n:n.parentElement:null}static get anchorOffset(){let e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){let e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(t.get())}static isSelectionAtEditor(e){if(!e)return!1;let n=e.anchorNode||e.focusNode;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let n=e.startContainer;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!t.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,n,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,n=e.createRange(),o.x=n.boundingLeft,o.y=n.boundingTop,o.width=n.boundingWidth,o.height=n.boundingHeight,o;if(!window.getSelection)return We("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return We("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(n=e.getRangeAt(0).cloneRange(),n.getBoundingClientRect&&(o=n.getBoundingClientRect()),o.x===0&&o.y===0){let r=document.createElement("span");if(r.getBoundingClientRect){r.appendChild(document.createTextNode("\u200B")),n.insertNode(r),o=r.getBoundingClientRect();let i=r.parentNode;i.removeChild(r),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,n=0){let o=document.createRange(),r=window.getSelection();return U.isNativeInput(e)?U.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=n,e.getBoundingClientRect()):void 0:(o.setStart(e,n),o.setEnd(e,n),r.removeAllRanges(),r.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){let n=t.range;return n===null?!1:e.contains(n.startContainer)}static addFakeCursor(){let e=t.range;if(e===null)return;let n=U.make("span","codex-editor__fake-cursor");n.dataset.mutationFree="true",e.collapse(),e.insertNode(n)}static isFakeCursorInsideContainer(e){return U.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){let n=U.find(e,".codex-editor__fake-cursor");n&&n.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=t.range}restore(){if(!this.savedSelectionRange)return;let e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){let e=window.getSelection(),n=document.createRange();n.selectNodeContents(e.focusNode),n.collapse(!1),e.removeAllRanges(),e.addRange(n)}findParentTag(e,n,o=10){let r=window.getSelection(),i=null;return!r||!r.anchorNode||!r.focusNode?null:([r.anchorNode,r.focusNode].forEach(s=>{let a=o;for(;a>0&&s.parentNode&&!(s.tagName===e&&(i=s,n&&s.classList&&!s.classList.contains(n)&&(i=null),i));)s=s.parentNode,a--}),i)}expandToTag(e){let n=window.getSelection();n.removeAllRanges();let o=document.createRange();o.selectNodeContents(e),n.addRange(o)}};function p5(t,e){let{type:n,target:o,addedNodes:r,removedNodes:i}=t;return t.type==="attributes"&&t.attributeName==="data-empty"?!1:!!(e.contains(o)||n==="childList"&&(Array.from(r).some(s=>s===e)||Array.from(i).some(s=>s===e)))}var Fm="redactor dom changed",bk="block changed",yk="fake cursor is about to be toggled",xk="fake cursor have been set",bc="editor mobile layout toggled";function Bm(t,e){if(!t.conversionConfig)return!1;let n=t.conversionConfig[e];return ht(n)||Dr(n)}function Xu(t,e){return Bm(t.tool,e)}function vk(t,e){return Object.entries(t).some(([n,o])=>e[n]&&i5(e[n],o))}async function Ck(t,e){let n=(await t.save()).data,o=e.find(r=>r.name===t.name);return o!==void 0&&!Bm(o,"export")?[]:e.reduce((r,i)=>{if(!Bm(i,"import")||i.toolbox===void 0)return r;let s=i.toolbox.filter(a=>{if(vo(a)||a.icon===void 0)return!1;if(a.data!==void 0){if(vk(a.data,n))return!1}else if(i.name===t.name)return!1;return!0});return r.push({...i,toolbox:s}),r},[])}function tk(t,e){return t.mergeable?t.name===e.name?!0:Xu(e,"export")&&Xu(t,"import"):!1}function f5(t,e){let n=e?.export;return ht(n)?n(t):Dr(n)?t[n]:(n!==void 0&&We("Conversion \xABexport\xBB property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function nk(t,e,n){let o=e?.import;return ht(o)?o(t,n):Dr(o)?{[o]:t}:(o!==void 0&&We("Conversion \xABimport\xBB property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var it=(t=>(t.Default="default",t.Separator="separator",t.Html="html",t))(it||{}),kr=(t=>(t.APPEND_CALLBACK="appendCallback",t.RENDERED="rendered",t.MOVED="moved",t.UPDATED="updated",t.REMOVED="removed",t.ON_PASTE="onPaste",t))(kr||{}),Do=class t extends ps{constructor({id:e=n5(),data:n,tool:o,readOnly:r,tunesData:i},s){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(a=void 0)=>{let l=a===void 0,c=a instanceof InputEvent;!l&&!c&&this.detectToolRootChange(a);let d;l||c?d=!0:d=!(a.length>0&&a.every(u=>{let{addedNodes:p,removedNodes:h,target:g}=u;return[...Array.from(p),...Array.from(h),g].some(m=>(U.isElement(m)||(m=m.parentElement),m&&m.closest('[data-mutation-free="true"]')!==null))})),d&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=s||null,this.blockAPI=new Sr(this),this.tool=o,this.toolInstance=o.create(n,this.blockAPI,r),this.tunes=o.tunes,this.composeTunes(i),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;let e=U.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){let n=this.inputs.findIndex(o=>o===e||o.contains(e));n!==-1&&(this.inputIndex=n)}get firstInput(){return this.inputs[0]}get lastInput(){let e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!vo(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return ht(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){let e=U.isEmpty(this.pluginsContent,"/"),n=!this.hasMedia;return e&&n}get hasMedia(){let e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var n,o;this.holder.classList.toggle(t.CSS.selected,e);let r=e===!0&&_e.isRangeInsideContainer(this.holder),i=e===!1&&_e.isFakeCursorInsideContainer(this.holder);(r||i)&&((n=this.editorEventBus)==null||n.emit(yk,{state:e}),r?_e.addFakeCursor():_e.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(xk,{state:e}))}get selected(){return this.holder.classList.contains(t.CSS.selected)}set stretched(e){this.holder.classList.toggle(t.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(t.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(t.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,n){if(ht(this.toolInstance[e])){e==="appendCallback"&&We("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,n)}catch(o){We(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){let e=await this.toolInstance.save(this.pluginsContent),n=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,s])=>{if(ht(s.save))try{n[i]=s.save()}catch(a){We(`Tune ${s.constructor.name} save method throws an Error %o`,"warn",a)}});let o=window.performance.now(),r;return Promise.resolve(e).then(i=>(r=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:n,time:r-o})).catch(i=>{We(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let n=!0;return this.toolInstance.validate instanceof Function&&(n=await this.toolInstance.validate(e)),n}getTunes(){let e=[],n=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return U.isElement(o)?e.push({type:it.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(r=>r.render()).forEach(r=>{U.isElement(r)?n.push({type:it.Html,element:r}):Array.isArray(r)?n.push(...r):n.push(r)}),{toolTunes:e,commonTunes:n}}updateCurrentInput(){this.currentInput=U.isNativeInput(document.activeElement)||!_e.anchorNode?document.activeElement:_e.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),ht(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){let e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);let n=await this.data,o=e;return o?.find(r=>vk(r.data,n))}async exportDataAsString(){let e=await this.data;return f5(e,this.tool.conversionConfig)}compose(){let e=U.make("div",t.CSS.wrapper),n=U.make("div",t.CSS.content),o=this.toolInstance.render();e.setAttribute("data-cy","block-wrapper"),e.dataset.id=this.id,this.toolRenderedElement=o,n.appendChild(this.toolRenderedElement);let r=n;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(ht(i.wrap))try{r=i.wrap(r)}catch(s){We(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",s)}}),e.appendChild(r),e}composeTunes(e){Array.from(this.tunes.values()).forEach(n=>{(n.isInternal?this.defaultTunesInstances:this.tunesInstances).set(n.name,n.create(e[n.name],this.blockAPI))}),Object.entries(e).forEach(([n,o])=>{this.tunesInstances.has(n)||(this.unavailableTunesData[n]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),U.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),U.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=n=>{let{mutations:o}=n;o.some(r=>p5(r,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(Fm,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(Fm,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(n=>{if(Array.from(n.removedNodes).includes(this.toolRenderedElement)){let o=n.addedNodes[n.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(gk)}},$m=class extends Le{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,n={},o={},r,i,s,a)=>{let l=this.Editor.BlockManager.insert({id:a,tool:e,data:n,index:r,needToFocus:i,replace:s});return new Sr(l)},this.composeBlockData=async e=>{let n=this.Editor.Tools.blockTools.get(e);return new Do({tool:n,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,n,o)=>{let{BlockManager:r}=this.Editor,i=r.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);let s=await r.update(i,n,o);return new Sr(s)},this.convert=async(e,n,o)=>{var r,i;let{BlockManager:s,Tools:a}=this.Editor,l=s.getBlockById(e);if(!l)throw new Error(`Block with id "${e}" not found`);let c=a.blockTools.get(l.name),d=a.blockTools.get(n);if(!d)throw new Error(`Block Tool with type "${n}" not found`);let u=((r=c?.conversionConfig)==null?void 0:r.export)!==void 0,p=((i=d.conversionConfig)==null?void 0:i.import)!==void 0;if(u&&p){let h=await s.convert(l,n,o);return new Sr(h)}else{let h=[u?!1:qu(l.name),p?!1:qu(n)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${n}" is not possible. ${h} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,n=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(n);let o=e.map(({id:r,type:i,data:s})=>this.Editor.BlockManager.composeBlock({id:r,tool:i||this.config.defaultBlock,data:s}));return this.Editor.BlockManager.insertMany(o,n),o.map(r=>new Sr(r))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,n)=>this.swap(e,n),move:(e,n)=>this.move(e,n),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,n=!0)=>this.stretchBlock(e,n),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){let n=this.Editor.BlockManager.getBlockById(e);if(!n){xo("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(n)}getBlockByIndex(e){let n=this.Editor.BlockManager.getBlockByIndex(e);if(n===void 0){xo("There is no block at index `"+e+"`","warn");return}return new Sr(n)}getById(e){let n=this.Editor.BlockManager.getBlockById(e);return n===void 0?(xo("There is no block with id `"+e+"`","warn"),null):new Sr(n)}getBlockByElement(e){let n=this.Editor.BlockManager.getBlock(e);if(n===void 0){xo("There is no block corresponding to element `"+e+"`","warn");return}return new Sr(n)}swap(e,n){We("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,n)}move(e,n){this.Editor.BlockManager.move(e,n)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{let n=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(n)}catch(n){xo(n,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}renderFromHTML(e){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,n=!0){Rm(!0,"blocks.stretchBlock()","BlockAPI");let o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=n)}insertNewBlock(){We("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}};function h5(t,e){return typeof t=="number"?e.BlockManager.getBlockByIndex(t):typeof t=="string"?e.BlockManager.getBlockById(t):e.BlockManager.getBlockById(t.id)}var zm=class extends Le{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,n),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,n),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,n),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,n),!0):!1,this.setToBlock=(e,n=this.Editor.Caret.positions.DEFAULT,o=0)=>{let r=h5(e,this.Editor);return r===void 0?!1:(this.Editor.Caret.setToBlock(r,n,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}},Hm=class extends Le{get methods(){return{emit:(e,n)=>this.emit(e,n),off:(e,n)=>this.off(e,n),on:(e,n)=>this.on(e,n)}}on(e,n){this.eventsDispatcher.on(e,n)}emit(e,n){this.eventsDispatcher.emit(e,n)}off(e,n){this.eventsDispatcher.off(e,n)}},Um=class t extends Le{static getNamespace(e,n){return n?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{xo("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,n){return Object.assign(this.methods,{t:o=>wn.t(t.getNamespace(e,n),o)})}},Km=class extends Le{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,n){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,n)})}},jm=class extends Le{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}},Vm=class extends Le{get methods(){return{on:(e,n,o,r)=>this.on(e,n,o,r),off:(e,n,o,r)=>this.off(e,n,o,r),offById:e=>this.offById(e)}}on(e,n,o,r){return this.listeners.on(e,n,o,r)}off(e,n,o,r){this.listeners.off(e,n,o,r)}offById(e){this.listeners.offById(e)}},Ek={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="/",r(r.s=0)})([function(n,o,r){r(1),n.exports=(function(){var i=r(6),s="cdx-notify--bounce-in",a=null;return{show:function(l){if(l.message){(function(){if(a)return!0;a=i.getWrapper(),document.body.appendChild(a)})();var c=null,d=l.time||8e3;switch(l.type){case"confirm":c=i.confirm(l);break;case"prompt":c=i.prompt(l);break;default:c=i.alert(l),window.setTimeout(function(){c.remove()},d)}a.appendChild(c),c.classList.add(s)}}}})()},function(n,o,r){var i=r(2);typeof i=="string"&&(i=[[n.i,i,""]]);var s={hmr:!0,transform:void 0,insertInto:void 0};r(4)(i,s),i.locals&&(n.exports=i.locals)},function(n,o,r){(n.exports=r(3)(!1)).push([n.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(n,o){n.exports=function(r){var i=[];return i.toString=function(){return this.map(function(s){var a=(function(l,c){var d=l[1]||"",u=l[3];if(!u)return d;if(c&&typeof btoa=="function"){var p=(g=u,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(g))))+" */"),h=u.sources.map(function(m){return"/*# sourceURL="+u.sourceRoot+m+" */"});return[d].concat(h).concat([p]).join(`
92
+ `)}var g;return[d].join(`
93
+ `)})(s,r);return s[2]?"@media "+s[2]+"{"+a+"}":a}).join("")},i.i=function(s,a){typeof s=="string"&&(s=[[null,s,""]]);for(var l={},c=0;c<this.length;c++){var d=this[c][0];typeof d=="number"&&(l[d]=!0)}for(c=0;c<s.length;c++){var u=s[c];typeof u[0]=="number"&&l[u[0]]||(a&&!u[2]?u[2]=a:a&&(u[2]="("+u[2]+") and ("+a+")"),i.push(u))}},i}},function(n,o,r){var i,s,a={},l=(i=function(){return window&&document&&document.all&&!window.atob},function(){return s===void 0&&(s=i.apply(this,arguments)),s}),c=(function(T){var w={};return function(S){if(typeof S=="function")return S();if(w[S]===void 0){var N=(function(D){return document.querySelector(D)}).call(this,S);if(window.HTMLIFrameElement&&N instanceof window.HTMLIFrameElement)try{N=N.contentDocument.head}catch{N=null}w[S]=N}return w[S]}})(),d=null,u=0,p=[],h=r(5);function g(T,w){for(var S=0;S<T.length;S++){var N=T[S],D=a[N.id];if(D){D.refs++;for(var O=0;O<D.parts.length;O++)D.parts[O](N.parts[O]);for(;O<N.parts.length;O++)D.parts.push(x(N.parts[O],w))}else{var A=[];for(O=0;O<N.parts.length;O++)A.push(x(N.parts[O],w));a[N.id]={id:N.id,refs:1,parts:A}}}}function m(T,w){for(var S=[],N={},D=0;D<T.length;D++){var O=T[D],A=w.base?O[0]+w.base:O[0],I={css:O[1],media:O[2],sourceMap:O[3]};N[A]?N[A].parts.push(I):S.push(N[A]={id:A,parts:[I]})}return S}function _(T,w){var S=c(T.insertInto);if(!S)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var N=p[p.length-1];if(T.insertAt==="top")N?N.nextSibling?S.insertBefore(w,N.nextSibling):S.appendChild(w):S.insertBefore(w,S.firstChild),p.push(w);else if(T.insertAt==="bottom")S.appendChild(w);else{if(typeof T.insertAt!="object"||!T.insertAt.before)throw new Error(`[Style Loader]
94
+
95
+ Invalid value for parameter 'insertAt' ('options.insertAt') found.
96
+ Must be 'top', 'bottom', or Object.
97
+ (https://github.com/webpack-contrib/style-loader#insertat)
98
+ `);var D=c(T.insertInto+" "+T.insertAt.before);S.insertBefore(w,D)}}function b(T){if(T.parentNode===null)return!1;T.parentNode.removeChild(T);var w=p.indexOf(T);w>=0&&p.splice(w,1)}function y(T){var w=document.createElement("style");return T.attrs.type===void 0&&(T.attrs.type="text/css"),v(w,T.attrs),_(T,w),w}function v(T,w){Object.keys(w).forEach(function(S){T.setAttribute(S,w[S])})}function x(T,w){var S,N,D,O;if(w.transform&&T.css){if(!(O=w.transform(T.css)))return function(){};T.css=O}if(w.singleton){var A=u++;S=d||(d=y(w)),N=k.bind(null,S,A,!1),D=k.bind(null,S,A,!0)}else T.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(S=(function(I){var R=document.createElement("link");return I.attrs.type===void 0&&(I.attrs.type="text/css"),I.attrs.rel="stylesheet",v(R,I.attrs),_(I,R),R})(w),N=(function(I,R,$){var W=$.css,P=$.sourceMap,q=R.convertToAbsoluteUrls===void 0&&P;(R.convertToAbsoluteUrls||q)&&(W=h(W)),P&&(W+=`
99
+ /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(P))))+" */");var ce=new Blob([W],{type:"text/css"}),rt=I.href;I.href=URL.createObjectURL(ce),rt&&URL.revokeObjectURL(rt)}).bind(null,S,w),D=function(){b(S),S.href&&URL.revokeObjectURL(S.href)}):(S=y(w),N=(function(I,R){var $=R.css,W=R.media;if(W&&I.setAttribute("media",W),I.styleSheet)I.styleSheet.cssText=$;else{for(;I.firstChild;)I.removeChild(I.firstChild);I.appendChild(document.createTextNode($))}}).bind(null,S),D=function(){b(S)});return N(T),function(I){if(I){if(I.css===T.css&&I.media===T.media&&I.sourceMap===T.sourceMap)return;N(T=I)}else D()}}n.exports=function(T,w){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(w=w||{}).attrs=typeof w.attrs=="object"?w.attrs:{},w.singleton||typeof w.singleton=="boolean"||(w.singleton=l()),w.insertInto||(w.insertInto="head"),w.insertAt||(w.insertAt="bottom");var S=m(T,w);return g(S,w),function(N){for(var D=[],O=0;O<S.length;O++){var A=S[O];(I=a[A.id]).refs--,D.push(I)}for(N&&g(m(N,w),w),O=0;O<D.length;O++){var I;if((I=D[O]).refs===0){for(var R=0;R<I.parts.length;R++)I.parts[R]();delete a[I.id]}}}};var C,E=(C=[],function(T,w){return C[T]=w,C.filter(Boolean).join(`
100
+ `)});function k(T,w,S,N){var D=S?"":N.css;if(T.styleSheet)T.styleSheet.cssText=E(w,D);else{var O=document.createTextNode(D),A=T.childNodes;A[w]&&T.removeChild(A[w]),A.length?T.insertBefore(O,A[w]):T.appendChild(O)}}},function(n,o){n.exports=function(r){var i=typeof window<"u"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!r||typeof r!="string")return r;var s=i.protocol+"//"+i.host,a=s+i.pathname.replace(/\/[^\/]*$/,"/");return r.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,c){var d,u=c.trim().replace(/^"(.*)"$/,function(p,h){return h}).replace(/^'(.*)'$/,function(p,h){return h});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(u)?l:(d=u.indexOf("//")===0?u:u.indexOf("/")===0?s+u:a+u.replace(/^\.\//,""),"url("+JSON.stringify(d)+")")})}},function(n,o,r){var i,s,a,l,c,d,u,p,h;n.exports=(i="cdx-notifies",s="cdx-notify",a="cdx-notify__cross",l="cdx-notify__button--confirm",c="cdx-notify__button--cancel",d="cdx-notify__input",u="cdx-notify__button",p="cdx-notify__btns-wrapper",{alert:h=function(g){var m=document.createElement("DIV"),_=document.createElement("DIV"),b=g.message,y=g.style;return m.classList.add(s),y&&m.classList.add(s+"--"+y),m.innerHTML=b,_.classList.add(a),_.addEventListener("click",m.remove.bind(m)),m.appendChild(_),m},confirm:function(g){var m=h(g),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("button"),v=m.querySelector("."+a),x=g.cancelHandler,C=g.okHandler;return _.classList.add(p),b.innerHTML=g.okText||"Confirm",y.innerHTML=g.cancelText||"Cancel",b.classList.add(u),y.classList.add(u),b.classList.add(l),y.classList.add(c),x&&typeof x=="function"&&(y.addEventListener("click",x),v.addEventListener("click",x)),C&&typeof C=="function"&&b.addEventListener("click",C),b.addEventListener("click",m.remove.bind(m)),y.addEventListener("click",m.remove.bind(m)),_.appendChild(b),_.appendChild(y),m.appendChild(_),m},prompt:function(g){var m=h(g),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("input"),v=m.querySelector("."+a),x=g.cancelHandler,C=g.okHandler;return _.classList.add(p),b.innerHTML=g.okText||"Ok",b.classList.add(u),b.classList.add(l),y.classList.add(d),g.placeholder&&y.setAttribute("placeholder",g.placeholder),g.default&&(y.value=g.default),g.inputType&&(y.type=g.inputType),x&&typeof x=="function"&&v.addEventListener("click",x),C&&typeof C=="function"&&b.addEventListener("click",function(){C(y.value)}),b.addEventListener("click",m.remove.bind(m)),_.appendChild(y),_.appendChild(b),m.appendChild(_),m},getWrapper:function(){var g=document.createElement("DIV");return g.classList.add(i),g}})}])})})(Ek);var g5=Ek.exports,m5=pp(g5),Wm=class{show(e){m5.show(e)}},Gm=class extends Le{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.notifier=new Wm}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}},Ym=class extends Le{get methods(){let e=()=>this.isEnabled;return{toggle:n=>this.toggle(n),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}},wk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(_c,function(){function n(u){var p=u.tags,h=Object.keys(p),g=h.map(function(m){return typeof p[m]}).every(function(m){return m==="object"||m==="boolean"||m==="function"});if(!g)throw new Error("The configuration was invalid");this.config=u}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function r(u){return o.indexOf(u.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function s(u){return i.indexOf(u.nodeName)!==-1}n.prototype.clean=function(u){let p=document.implementation.createHTMLDocument(),h=p.createElement("div");return h.innerHTML=u,this._sanitize(p,h),h.innerHTML},n.prototype._sanitize=function(u,p){var h=a(u,p),g=h.firstChild();if(g)do{if(g.nodeType===Node.TEXT_NODE)if(g.data.trim()===""&&(g.previousElementSibling&&r(g.previousElementSibling)||g.nextElementSibling&&r(g.nextElementSibling))){p.removeChild(g),this._sanitize(u,p);break}else continue;if(g.nodeType===Node.COMMENT_NODE){p.removeChild(g),this._sanitize(u,p);break}var m=s(g),_;m&&(_=Array.prototype.some.call(g.childNodes,r));var b=!!p.parentNode,y=r(p)&&r(g)&&b,v=g.nodeName.toLowerCase(),x=l(this.config,v,g),C=m&&_;if(C||c(g,x)||!this.config.keepNestedBlockElements&&y){if(!(g.nodeName==="SCRIPT"||g.nodeName==="STYLE"))for(;g.childNodes.length>0;)p.insertBefore(g.childNodes[0],g);p.removeChild(g),this._sanitize(u,p);break}for(var E=0;E<g.attributes.length;E+=1){var k=g.attributes[E];d(k,x,g)&&(g.removeAttribute(k.name),E=E-1)}this._sanitize(u,g)}while(g=h.nextSibling())};function a(u,p){return u.createTreeWalker(p,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(u,p,h){return typeof u.tags[p]=="function"?u.tags[p](h):u.tags[p]}function c(u,p){return typeof p>"u"?!0:typeof p=="boolean"?!p:!1}function d(u,p,h){var g=u.name.toLowerCase();return p===!0?!1:typeof p[g]=="function"?!p[g](u.value,h):typeof p[g]>"u"||p[g]===!1?!0:typeof p[g]=="string"?p[g]!==u.value:!1}return n})})(wk);var _5=wk.exports,b5=pp(_5);function M_(t,e){return t.map(n=>{let o=ht(e)?e(n.tool):e;return vo(o)||(n.data=L_(n.data,o)),n})}function Zo(t,e={}){let n={tags:e};return new b5(n).clean(t)}function L_(t,e){return Array.isArray(t)?y5(t,e):an(t)?x5(t,e):Dr(t)?v5(t,e):t}function y5(t,e){return t.map(n=>L_(n,e))}function x5(t,e){let n={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let r=t[o],i=C5(e[o])?e[o]:e;n[o]=L_(r,i)}return n}function v5(t,e){return an(e)?Zo(t,e):e===!1?Zo(t,{}):t}function C5(t){return an(t)||J4(t)||ht(t)}var qm=class extends Le{get methods(){return{clean:(e,n)=>this.clean(e,n)}}clean(e,n){return Zo(e,n)}},Jm=class extends Le{get methods(){return{save:()=>this.save()}}save(){let e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(xo(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}},Xm=class extends Le{constructor(){super(...arguments),this.selectionUtils=new _e}get methods(){return{findParentTag:(e,n)=>this.findParentTag(e,n),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,n){return this.selectionUtils.findParentTag(e,n)}expandToTag(e){this.selectionUtils.expandToTag(e)}},Zm=class extends Le{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}},Qm=class extends Le{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}},e_=class extends Le{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){xo("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){xo("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}},Tk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){n.exports=r(1)},function(n,o,r){r.r(o),r.d(o,"default",function(){return i});class i{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);let d=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(d.hidingDelay&&(this.hidingDelay=d.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of \xABcontent\xBB passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),d.placement){case"top":this.placeTop(a,d);break;case"left":this.placeLeft(a,d);break;case"right":this.placeRight(a,d);break;default:this.placeBottom(a,d)}d&&d.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},d.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){let a="codex-tooltips-style";if(document.getElementById(a))return;let l=r(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",d,u)}placeTop(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",d,u)}placeLeft(a,l){let c=a.getBoundingClientRect(),d=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",d,u)}placeRight(a,l){let c=a.getBoundingClientRect(),d=c.right+this.offsetRight+l.marginRight,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",d,u)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){let d=document.createElement(a);Array.isArray(l)?d.classList.add(...l):l&&d.classList.add(l);for(let u in c)c.hasOwnProperty(u)&&(d[u]=c[u]);return d}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(n,o){n.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(Tk);var E5=Tk.exports,w5=pp(E5),Oo=null;function R_(){Oo||(Oo=new w5)}function T5(t,e,n){R_(),Oo?.show(t,e,n)}function Zu(t=!1){R_(),Oo?.hide(t)}function Qu(t,e,n){R_(),Oo?.onHover(t,e,n)}function S5(){Oo?.destroy(),Oo=null}var t_=class extends Le{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n})}get methods(){return{show:(e,n,o)=>this.show(e,n,o),hide:()=>this.hide(),onHover:(e,n,o)=>this.onHover(e,n,o)}}show(e,n,o){T5(e,n,o)}hide(){Zu()}onHover(e,n,o){Qu(e,n,o)}},n_=class extends Le{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}};function Sk(t,e){let n={};return Object.entries(t).forEach(([o,r])=>{if(an(r)){let i=e?`${e}.${o}`:o;Object.values(r).every(s=>Dr(s))?n[o]=i:n[o]=Sk(r,i);return}n[o]=r}),n}var oo=Sk(mk);function k5(t,e){let n={};return Object.keys(t).forEach(o=>{let r=e[o];r!==void 0?n[r]=t[o]:n[o]=t[o]}),n}var kk=class hc{constructor(e,n){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=n}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(hc.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(hc.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let n=this.cursor;return n===-1?n=e===hc.directions.RIGHT?-1:0:this.items[n].classList.remove(this.focusedCssClass),e===hc.directions.RIGHT?n=(n+1)%this.items.length:n=(this.items.length+n-1)%this.items.length,U.canSetCaret(this.items[n])&&Yu(()=>_e.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),n}};kk.directions={RIGHT:"right",LEFT:"left"};var uc=kk,wa=class t{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=n=>{if(this.isEventReadyForHandling(n))switch(t.usedKeys.includes(n.keyCode)&&n.preventDefault(),n.keyCode){case we.TAB:this.handleTabPress(n);break;case we.LEFT:case we.UP:this.flipLeft();break;case we.RIGHT:case we.DOWN:this.flipRight();break;case we.ENTER:this.handleEnterPress(n);break}},this.iterator=new uc(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||t.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[we.TAB,we.LEFT,we.RIGHT,we.ENTER,we.UP,we.DOWN]}activate(e,n){this.activated=!0,e&&this.iterator.setItems(e),n!==void 0&&this.iterator.setCursor(n),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(n=>n!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?uc.directions.LEFT:uc.directions.RIGHT){case uc.directions.RIGHT:this.flipRight();break;case uc.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),ht(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}},N5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',D5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',O5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',I5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',A5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',M5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',L5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',R5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',ok='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',P5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',F5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',Nk='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',B5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',$5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',z5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',H5="__",U5="--";function hi(t){return(e,n)=>[[t,e].filter(o=>!!o).join(H5),n].filter(o=>!!o).join(U5)}var pc=hi("ce-hint"),fc={root:pc(),alignedStart:pc(null,"align-left"),alignedCenter:pc(null,"align-center"),title:pc("title"),description:pc("description")},o_=class{constructor(e){this.nodes={root:U.make("div",[fc.root,e.alignment==="center"?fc.alignedCenter:fc.alignedStart]),title:U.make("div",fc.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=U.make("div",fc.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}},yc=class{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){Zu()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,n;this.params!==void 0&&"onActivate"in this.params&&((n=(e=this.params).onActivate)==null||n.call(e,this.params))}addHint(e,n){let o=new o_(n);Qu(e,o.getElement(),{placement:n.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}},no=hi("ce-popover-item"),xt={container:no(),active:no(null,"active"),disabled:no(null,"disabled"),focused:no(null,"focused"),hidden:no(null,"hidden"),confirmationState:no(null,"confirmation"),noHover:no(null,"no-hover"),noFocus:no(null,"no-focus"),title:no("title"),secondaryTitle:no("secondary-title"),icon:no("icon"),iconTool:no("icon","tool"),iconChevronRight:no("icon","chevron-right"),wobbleAnimation:hi("wobble")()},Nr=class extends yc{constructor(e,n){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(xt.noFocus)},this.removeSpecialHoverBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(xt.noHover)},this.onErrorAnimationEnd=()=>{var o,r;(o=this.nodes.icon)==null||o.classList.remove(xt.wobbleAnimation),(r=this.nodes.icon)==null||r.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,n)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(xt.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var n;(n=this.nodes.root)==null||n.classList.toggle(xt.active,e)}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(xt.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,n){var o,r;let i=n?.wrapperTag||"div",s=U.make(i,xt.container,{type:i==="button"?"button":void 0});return e.name&&(s.dataset.itemName=e.name),this.nodes.icon=U.make("div",[xt.icon,xt.iconTool],{innerHTML:e.icon||L5}),s.appendChild(this.nodes.icon),e.title!==void 0&&s.appendChild(U.make("div",xt.title,{innerHTML:e.title||""})),e.secondaryLabel&&s.appendChild(U.make("div",xt.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&s.appendChild(U.make("div",[xt.icon,xt.iconChevronRight],{innerHTML:I5})),this.isActive&&s.classList.add(xt.active),e.isDisabled&&s.classList.add(xt.disabled),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(s,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"}),s}enableConfirmationMode(e){if(this.nodes.root===null)return;let n={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},o=this.make(n);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(xt.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;let e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(xt.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,n,o;(e=this.nodes.root)==null||e.classList.add(xt.noHover),(n=this.nodes.root)==null||n.classList.add(xt.noFocus),(o=this.nodes.root)==null||o.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var n;if(!("confirmation"in e)||e.confirmation===void 0)try{(n=e.onActivate)==null||n.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,n,o;(e=this.nodes.icon)!=null&&e.classList.contains(xt.wobbleAnimation)||((n=this.nodes.icon)==null||n.classList.add(xt.wobbleAnimation),(o=this.nodes.icon)==null||o.addEventListener("animationend",this.onErrorAnimationEnd))}},km=hi("ce-popover-item-separator"),Nm={container:km(),line:km("line"),hidden:km(null,"hidden")},ep=class extends yc{constructor(){super(),this.nodes={root:U.make("div",Nm.container),line:U.make("div",Nm.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(Nm.hidden,e)}},Qo=(t=>(t.Closed="closed",t.ClosedOnActivate="closed-on-activate",t))(Qo||{}),En=hi("ce-popover"),St={popover:En(),popoverContainer:En("container"),popoverOpenTop:En(null,"open-top"),popoverOpenLeft:En(null,"open-left"),popoverOpened:En(null,"opened"),search:En("search"),nothingFoundMessage:En("nothing-found-message"),nothingFoundMessageDisplayed:En("nothing-found-message","displayed"),items:En("items"),overlay:En("overlay"),overlayHidden:En("overlay","hidden"),popoverNested:En(null,"nested"),getPopoverNestedClass:t=>En(null,`nested-level-${t.toString()}`),popoverInline:En(null,"inline"),popoverHeader:En("header")},Ea=(t=>(t.NestingLevel="--nesting-level",t.PopoverHeight="--popover-height",t.InlinePopoverWidth="--inline-popover-width",t.TriggerItemLeft="--trigger-item-left",t.TriggerItemTop="--trigger-item-top",t))(Ea||{}),rk=hi("ce-popover-item-html"),ik={root:rk(),hidden:rk(null,"hidden")},hs=class extends yc{constructor(e,n){var o,r;super(e),this.nodes={root:U.make("div",ik.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(ik.hidden,e)}getControls(){let e=this.nodes.root.querySelectorAll(`button, ${U.allInputsSelector}`);return Array.from(e)}},tp=class extends ps{constructor(e,n={}){super(),this.params=e,this.itemsRenderParams=n,this.listeners=new fs,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=U.make("div",[St.popoverContainer]),this.nodes.nothingFoundMessage=U.make("div",[St.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=U.make("div",[St.items]),this.items.forEach(o=>{let r=o.getElement();r!==null&&this.nodes.items.appendChild(r)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o)),this.nodes.popover=U.make("div",[St.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof Nr)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(St.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(St.popoverOpened),this.nodes.popover.classList.remove(St.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Qo.Closed)}destroy(){var e;this.items.forEach(n=>n.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){let n=this.items.find(o=>o.name===e);this.handleItemClick(n)}buildItems(e){return e.map(n=>{switch(n.type){case it.Separator:return new ep;case it.Html:return new hs(n,this.itemsRenderParams[it.Html]);default:return new Nr(n,this.itemsRenderParams[it.Default])}})}getTargetItem(e){return this.items.filter(n=>n instanceof Nr||n instanceof hs).find(n=>{let o=n.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(n=>n!==e).forEach(n=>n.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(Qo.ClosedOnActivate))}}handleClick(e){let n=this.getTargetItem(e);n!==void 0&&this.handleItemClick(n)}toggleItemActivenessIfNeeded(e){if(e instanceof Nr&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){let n=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(n.length===1){e.toggleActive();return}n.forEach(o=>{o.toggleActive(o===e)})}}},np=(t=>(t.Search="search",t))(np||{}),Dm=hi("cdx-search-field"),Om={wrapper:Dm(),icon:Dm("icon"),input:Dm("input")},r_=class extends ps{constructor({items:e,placeholder:n}){super(),this.listeners=new fs,this.items=e,this.wrapper=U.make("div",Om.wrapper);let o=U.make("div",Om.icon,{innerHTML:B5});this.input=U.make("input",Om.input,{placeholder:n,tabIndex:-1}),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(np.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(np.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,o;let r=((n=e.title)==null?void 0:n.toLowerCase())||"",i=(o=this.searchQuery)==null?void 0:o.toLowerCase();return i!==void 0?r.includes(i):!1}},K5=Object.defineProperty,j5=Object.getOwnPropertyDescriptor,V5=(t,e,n,o)=>{for(var r=o>1?void 0:o?j5(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&K5(e,n,r),r},Dk=class Ok extends tp{constructor(e,n){super(e,n),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{let o=this.itemsDefault.find(r=>r.isFocused);o?.onFocus()},this.onSearch=o=>{var r;let i=o.query==="",s=o.items.length===0;this.items.forEach(l=>{let c=!1;l instanceof Nr?c=!o.items.includes(l):(l instanceof ep||l instanceof hs)&&(c=s||!i),l.toggleHidden(c)}),this.toggleNothingFoundMessage(s);let a=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(r=this.flipper)!=null&&r.isActivated&&(this.flipper.deactivate(),this.flipper.activate(a))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(St.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new wa({items:this.flippableElements,focusedItemClass:xt.focused,allowedKeys:[we.TAB,we.UP,we.DOWN,we.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(Ea.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(St.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(St.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){let n=this.getTargetItem(e);n!==void 0&&this.previouslyHoveredItem!==n&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=n,n.hasChildren&&this.showNestedPopoverForItem(n))}setTriggerItemPosition(e,n){let o=n.getElement(),r=(o?o.offsetTop:0)-this.scrollTop,i=this.offsetTop+r;e.style.setProperty(Ea.TriggerItemTop,i+"px")}destroyNestedPopoverIfExists(){var e,n;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(Qo.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose())}showNestedPopoverForItem(e){var n;this.nestedPopover=new Ok({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(Qo.ClosedOnActivate,this.hide);let o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(o),this.setTriggerItemPosition(o,e),o.style.setProperty(Ea.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popoverContainer.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.height,r=e.top+o,i=e.top-o,s=Math.min(window.innerHeight,n.bottom);return i<n.top||r<=s}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popover.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.width,r=e.right+o,i=e.left-o,s=Math.min(window.innerWidth,n.right);return i<n.left||r<=s}get size(){var e;let n={height:0,width:0};if(this.nodes.popover===null)return n;let o=this.nodes.popover.cloneNode(!0);o.style.visibility="hidden",o.style.position="absolute",o.style.top="-1000px",o.classList.add(St.popoverOpened),(e=o.querySelector("."+St.popoverNested))==null||e.remove(),document.body.appendChild(o);let r=o.querySelector("."+St.popoverContainer);return n.height=r.offsetHeight,n.width=r.offsetWidth,o.remove(),n}get flippableElements(){return this.items.map(e=>{if(e instanceof Nr)return e.getElement();if(e instanceof hs)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new r_({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(np.Search,this.onSearch);let e=this.search.getElement();e.classList.add(St.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(St.nothingFoundMessageDisplayed,e)}};V5([Sa],Dk.prototype,"size",1);var P_=Dk,i_=class extends P_{constructor(e){let n=!ka();super({...e,class:St.popoverInline},{[it.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:n}},[it.Html]:{hint:{position:"top",alignment:"center",enabled:n}}}),this.items.forEach(o=>{!(o instanceof Nr)&&!(o instanceof hs)||o.hasChildren&&o.isChildrenOpen&&this.showNestedItems(o)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(Ea.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,n){let o=n.getElement(),r=o?o.offsetLeft:0,i=this.offsetLeft+r;e.style.setProperty(Ea.TriggerItemLeft,i+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){let n=super.showNestedPopoverForItem(e);return n.getElement().classList.add(St.getPopoverNestedClass(n.nestingLevel)),n}handleItemClick(e){var n;e!==this.nestedPopoverTriggerItem&&((n=this.nestedPopoverTriggerItem)==null||n.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}},Ik=class gc{constructor(){this.scrollPosition=null}lock(){Pm?this.lockHard():document.body.classList.add(gc.CSS.scrollLocked)}unlock(){Pm?this.unlockHard():document.body.classList.remove(gc.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(gc.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(gc.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};Ik.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};var W5=Ik,Im=hi("ce-popover-header"),Am={root:Im(),text:Im("text"),backButton:Im("back-button")},s_=class{constructor({text:e,onBackButtonClick:n}){this.listeners=new fs,this.text=e,this.onBackButtonClick=n,this.nodes={root:U.make("div",[Am.root]),backButton:U.make("button",[Am.backButton]),text:U.make("div",[Am.text])},this.nodes.backButton.innerHTML=O5,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}},a_=class{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}},op=class extends tp{constructor(e){super(e,{[it.Default]:{hint:{enabled:!1}},[it.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new W5,this.history=new a_,this.isHidden=!0,this.nodes.overlay=U.make("div",[St.overlay,St.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(St.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(St.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,n){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),n!==void 0){this.header=new s_({text:n,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});let o=this.header.getElement();o!==null&&this.nodes.popoverContainer.insertBefore(o,this.nodes.popoverContainer.firstChild)}this.items.forEach(o=>{var r;return(r=o.getElement())==null?void 0:r.remove()}),this.items=this.buildItems(e),this.items.forEach(o=>{var r;let i=o.getElement();i!==null&&((r=this.nodes.items)==null||r.appendChild(i))})}},l_=class extends Le{constructor(){super(...arguments),this.opened=!1,this.selection=new _e,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,_e.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Qo.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=U.make("div",[this.CSS.settings]),this.nodes.wrapper.setAttribute("data-cy","block-tunes"),this.eventsDispatcher.on(bc,this.close)}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.eventsDispatcher.off(bc,this.close)}async open(e=this.Editor.BlockManager.currentBlock){var n;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();let{toolTunes:o,commonTunes:r}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);let i=ka()?op:P_;this.popover=new i({searchable:!0,items:await this.getTunesItems(e,r,o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:wn.ui(oo.ui.popover,"Nothing found"),search:wn.ui(oo.ui.popover,"Filter")}}),this.popover.on(Qo.Closed,this.onPopoverClose),(n=this.nodes.wrapper)==null||n.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,n,o){let r=[];o!==void 0&&o.length>0&&(r.push(...o),r.push({type:it.Separator}));let i=Array.from(this.Editor.Tools.blockTools.values()),s=(await Ck(e,i)).reduce((a,l)=>(l.toolbox.forEach(c=>{a.push({icon:c.icon,title:wn.t(oo.toolNames,c.title),name:l.name,closeOnActivate:!0,onActivate:async()=>{let{BlockManager:d,Caret:u,Toolbar:p}=this.Editor,h=await d.convert(e,l.name,c.data);p.close(),u.setToBlock(h,u.positions.END)}})}),a),[]);return s.length>0&&(r.push({icon:Nk,name:"convert-to",title:wn.ui(oo.ui.popover,"Convert to"),children:{searchable:!0,items:s}}),r.push({type:it.Separator})),r.push(...n),r.map(a=>this.resolveTuneAliases(a))}resolveTuneAliases(e){if(e.type===it.Separator||e.type===it.Html)return e;let n=k5(e,{label:"title"});return e.confirmation&&(n.confirmation=this.resolveTuneAliases(e.confirmation)),n}},Ak={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){function i(l,c){for(var d=0;d<c.length;d++){var u=c[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(l,u.key,u)}}function s(l,c,d){return c&&i(l.prototype,c),d&&i(l,d),l}r.r(o);var a=(function(){function l(c){var d=this;(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=c.name,this.parseShortcutName(c.name),this.element=c.on,this.callback=c.callback,this.executeShortcut=function(u){d.execute(u)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return s(l,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),s(l,[{key:"parseShortcutName",value:function(c){c=c.split("+");for(var d=0;d<c.length;d++){c[d]=c[d].toUpperCase();var u=!1;for(var p in l.supportedCommands)if(l.supportedCommands[p].includes(c[d])){u=this.commands[p]=!0;break}u||(this.keys[c[d]]=!0)}for(var h in l.supportedCommands)this.commands[h]||(this.commands[h]=!1)}},{key:"execute",value:function(c){var d,u={CMD:c.ctrlKey||c.metaKey,SHIFT:c.shiftKey,ALT:c.altKey},p=!0;for(d in this.commands)this.commands[d]!==u[d]&&(p=!1);var h,g=!0;for(h in this.keys)g=g&&c.keyCode===l.keyCodes[h];p&&g&&this.callback(c)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l})();o.default=a}]).default})})(Ak);var G5=Ak.exports,Y5=pp(G5),c_=class{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);let n=new Y5({name:e.name,on:e.on,callback:e.handler}),o=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...o,n])}remove(e,n){let o=this.findShortcut(e,n);if(!o)return;o.remove();let r=this.registeredShortcuts.get(e);this.registeredShortcuts.set(e,r.filter(i=>i!==o))}findShortcut(e,n){return(this.registeredShortcuts.get(e)||[]).find(({name:o})=>o===n)}},Ta=new c_,q5=Object.defineProperty,J5=Object.getOwnPropertyDescriptor,Mk=(t,e,n,o)=>{for(var r=o>1?void 0:o?J5(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&q5(e,n,r),r},Ku=(t=>(t.Opened="toolbox-opened",t.Closed="toolbox-closed",t.BlockAdded="toolbox-block-added",t))(Ku||{}),F_=class Lk extends ps{constructor({api:e,tools:n,i18nLabels:o}){super(),this.opened=!1,this.listeners=new fs,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=n,this.i18nLabels=o,this.enableShortcuts(),this.nodes={toolbox:U.make("div",Lk.CSS.toolbox)},this.initPopover(),this.nodes.toolbox.setAttribute("data-cy","toolbox"),this.api.events.on(bc,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Qo.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(bc,this.handleMobileLayoutToggle)}toolButtonActivated(e,n){this.insertNewBlock(e,n)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;let n=ka()?op:P_;this.popover=new n({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Qo.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Qo.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){let e=[];return this.tools.forEach(n=>{n.toolbox&&e.push(n)}),e}get toolboxItemsToBeDisplayed(){let e=(n,o,r=!0)=>({icon:n.icon,title:wn.t(oo.toolNames,n.title||qu(o.name)),name:o.name,onActivate:()=>{this.toolButtonActivated(o.name,n.data)},secondaryLabel:o.shortcut&&r?A_(o.shortcut):""});return this.toolsToBeDisplayed.reduce((n,o)=>(Array.isArray(o.toolbox)?o.toolbox.forEach((r,i)=>{n.push(e(r,o,i===0))}):o.toolbox!==void 0&&n.push(e(o.toolbox,o)),n),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&this.enableShortcutForTool(e.name,n)})}enableShortcutForTool(e,n){Ta.add({name:n,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();let r=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(r);if(i)try{let s=await this.api.blocks.convert(i.id,e);this.api.caret.setToBlock(s,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&Ta.remove(this.api.ui.nodes.redactor,n)})}async insertNewBlock(e,n){let o=this.api.blocks.getCurrentBlockIndex(),r=this.api.blocks.getBlockByIndex(o);if(!r)return;let i=r.isEmpty?o:o+1,s;if(n){let l=await this.api.blocks.composeBlockData(e);s=Object.assign(l,n)}let a=this.api.blocks.insert(e,s,void 0,i,void 0,r.isEmpty);a.call(kr.APPEND_CALLBACK),this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:a}),this.api.toolbar.close()}};Mk([Sa],F_.prototype,"toolsToBeDisplayed",1);Mk([Sa],F_.prototype,"toolboxItemsToBeDisplayed",1);var X5=F_,Rk="block hovered";async function Z5(t,e){let n=navigator.keyboard;if(!n)return e;try{return(await n.getLayoutMap()).get(t)||e}catch(o){return console.error(o),e}}var d_=class extends Le{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var n;(n=this.toolboxInstance)==null||n.close()},open:()=>{if(this.toolboxInstance===null){We("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){We("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var n;return(n=this.toolboxInstance)==null?void 0:n.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){We("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;let n=e.holder,{isMobile:o}=this.Editor.UI,r,i=20,s=e.firstInput,a=n.getBoundingClientRect(),l=s!==void 0?s.getBoundingClientRect():null,c=l!==null?l.top-a.top:null,d=c!==null?c>i:void 0;if(o)r=n.offsetTop+n.offsetHeight;else if(s===void 0||d){let u=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);r=n.offsetTop+u}else{let u=a5(s),p=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);r=n.offsetTop+u-p+8+c}this.nodes.wrapper.style.top=`${Math.floor(r)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,n;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=U.make("div",this.CSS.toolbar),["content","actions"].forEach(i=>{this.nodes[i]=U.make("div",this.CSS[i])}),U.append(this.nodes.wrapper,this.nodes.content),U.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=U.make("div",this.CSS.plusButton,{innerHTML:F5}),U.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{Zu(!0),this.plusButtonClicked()},!1);let e=U.make("div");e.appendChild(document.createTextNode(wn.ui(oo.ui.toolbar.toolbox,"Add"))),e.appendChild(U.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),Qu(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=U.make("span",this.CSS.settingsToggler,{innerHTML:P5}),U.append(this.nodes.actions,this.nodes.settingsToggler);let n=U.make("div"),o=U.text(wn.ui(oo.ui.blockTunes.toggler,"Click to tune")),r=await Z5("Slash","/");n.appendChild(o),n.appendChild(U.make("div",this.CSS.plusButtonShortcut,{textContent:A_(`CMD + ${r}`)})),Qu(this.nodes.settingsToggler,n,{hidingDelay:400}),U.append(this.nodes.actions,this.makeToolbox()),U.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),U.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new X5({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:wn.ui(oo.ui.popover,"Filter"),nothingFound:wn.ui(oo.ui.popover,"Nothing found")}}),this.toolboxInstance.on(Ku.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(Ku.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(Ku.BlockAdded,({block:e})=>{let{BlockManager:n,Caret:o}=this.Editor,r=n.getBlockById(e.id);r.inputs.length===0&&(r===n.lastBlock?(n.insertAtEnd(),o.setToBlock(n.lastBlock)):o.setToBlock(n.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var n;e.stopPropagation(),this.settingsTogglerClicked(),(n=this.toolboxInstance)!=null&&n.opened&&this.toolboxInstance.close(),Zu(!0)},!0),ka()||this.eventsDispatcher.on(Rk,e=>{var n;this.Editor.BlockSettings.opened||(n=this.toolboxInstance)!=null&&n.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}},ds=(t=>(t[t.Block=0]="Block",t[t.Inline=1]="Inline",t[t.Tune=2]="Tune",t))(ds||{}),ju=(t=>(t.Shortcut="shortcut",t.Toolbox="toolbox",t.EnabledInlineTools="inlineToolbar",t.EnabledBlockTunes="tunes",t.Config="config",t))(ju||{}),Pk=(t=>(t.Shortcut="shortcut",t.SanitizeConfig="sanitize",t))(Pk||{}),Ca=(t=>(t.IsEnabledLineBreaks="enableLineBreaks",t.Toolbox="toolbox",t.ConversionConfig="conversionConfig",t.IsReadOnlySupported="isReadOnlySupported",t.PasteConfig="pasteConfig",t))(Ca||{}),rp=(t=>(t.IsInline="isInline",t.Title="title",t.IsReadOnlySupported="isReadOnlySupported",t))(rp||{}),u_=(t=>(t.IsTune="isTune",t))(u_||{}),xc=class{constructor({name:e,constructable:n,config:o,api:r,isDefault:i,isInternal:s=!1,defaultPlaceholder:a}){this.api=r,this.name=e,this.constructable=n,this.config=o,this.isDefault=i,this.isInternal=s,this.defaultPlaceholder=a}get settings(){let e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(ht(this.constructable.reset))return this.constructable.reset()}prepare(){if(ht(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){let e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===ds.Inline}isBlock(){return this.type===ds.Block}isTune(){return this.type===ds.Tune}},p_=class extends Le{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=ka()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,n;if(this.opened){for(let[o,r]of this.tools){let i=this.getToolShortcut(o.name);i!==void 0&&Ta.remove(this.Editor.UI.nodes.redactor,i),ht(r.clear)&&r.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(n=this.popover)==null||n.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=U.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.wrapper.setAttribute("data-cy","inline-toolbar"),U.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();let n=await this.getPopoverItems();this.popover=new i_({items:n,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:wn.ui(oo.ui.popover,"Nothing found"),search:wn.ui(oo.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){let n=_e.rect,o=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),r={x:n.x-o.x,y:n.y+n.height-o.top+this.toolbarVerticalMargin};r.x+e+o.x>this.Editor.UI.contentRect.right&&(r.x=this.Editor.UI.contentRect.right-e-o.x),this.nodes.wrapper.style.left=Math.floor(r.x)+"px",this.nodes.wrapper.style.top=Math.floor(r.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){let e=["IMG","INPUT"],n=_e.get(),o=_e.text;if(!n||!n.anchorNode||n.isCollapsed||o.length<1)return!1;let r=U.isElement(n.anchorNode)?n.anchorNode:n.anchorNode.parentElement;if(r===null||n!==null&&e.includes(r.tagName))return!1;let i=this.Editor.BlockManager.getBlock(n.anchorNode);return!i||this.getTools().some(s=>i.tool.inlineTools.has(s.name))===!1?!1:r.closest("[contenteditable]")!==null}getTools(){let e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Editor.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{let n=e.create();this.tools.set(e,n)})}async getPopoverItems(){let e=[],n=0;for(let[o,r]of this.tools){let i=await r.render(),s=this.getToolShortcut(o.name);if(s!==void 0)try{this.enableShortcuts(o.name,s)}catch{}let a=s!==void 0?A_(s):void 0,l=wn.t(oo.toolNames,o.title||qu(o.name));[i].flat().forEach(c=>{var d,u;let p={name:o.name,onActivate:()=>{this.toolClicked(r)},hint:{title:l,description:a}};if(U.isElement(c)){let h={...p,element:c,type:it.Html};if(ht(r.renderActions)){let g=r.renderActions();h.children={isOpen:(d=r.checkState)==null?void 0:d.call(r,_e.get()),isFlippable:!1,items:[{type:it.Html,element:g}]}}else(u=r.checkState)==null||u.call(r,_e.get());e.push(h)}else if(c.type===it.Html)e.push({...p,...c,type:it.Html});else if(c.type===it.Separator)e.push({type:it.Separator});else{let h={...p,...c,type:it.Default};"children"in h&&n!==0&&e.push({type:it.Separator}),e.push(h),"children"in h&&n<this.tools.size-1&&e.push({type:it.Separator})}}),n++}return e}getToolShortcut(e){let{Tools:n}=this.Editor,o=n.inlineTools.get(e),r=n.internal.inlineTools;return Array.from(r.keys()).includes(e)?this.inlineTools[e][Pk.Shortcut]:o?.shortcut}enableShortcuts(e,n){Ta.add({name:n,handler:o=>{var r;let{currentBlock:i}=this.Editor.BlockManager;i&&i.tool.enabledInlineTools&&(o.preventDefault(),(r=this.popover)==null||r.activateItemByName(e))},on:document})}toolClicked(e){var n;let o=_e.range;(n=e.surround)==null||n.call(e,o),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(n=>{var o;(o=n.checkState)==null||o.call(n,_e.get())})}get inlineTools(){let e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([n,o])=>{e[n]=o.create()}),e}};function Fk(){let t=window.getSelection();if(t===null)return[null,0];let e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],n=e.textContent.length)),[e,n])}function Bk(t,e,n,o){let r=document.createRange();o==="left"?(r.setStart(t,0),r.setEnd(e,n)):(r.setStart(e,n),r.setEnd(t,t.childNodes.length));let i=r.cloneContents(),s=document.createElement("div");s.appendChild(i);let a=s.textContent||"";return s5(a)}function Vu(t){let e=U.getDeepestNode(t);if(e===null||U.isEmpty(t))return!0;if(U.isNativeInput(e))return e.selectionEnd===0;if(U.isEmpty(t))return!0;let[n,o]=Fk();return n===null?!1:Bk(t,n,o,"left")}function Wu(t){let e=U.getDeepestNode(t,!0);if(e===null)return!0;if(U.isNativeInput(e))return e.selectionEnd===e.value.length;let[n,o]=Fk();return n===null?!1:Bk(t,n,o,"right")}var $k={},B_={},fp={},gs={},$_={},z_={};Object.defineProperty(z_,"__esModule",{value:!0});z_.allInputsSelector=Q5;function Q5(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=z_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})($_);var ms={},H_={};Object.defineProperty(H_,"__esModule",{value:!0});H_.isNativeInput=eU;function eU(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=H_;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(ms);var zk={},U_={};Object.defineProperty(U_,"__esModule",{value:!0});U_.append=tU;function tU(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=U_;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})(zk);var K_={},j_={};Object.defineProperty(j_,"__esModule",{value:!0});j_.blockElements=nU;function nU(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=j_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(K_);var Hk={},V_={};Object.defineProperty(V_,"__esModule",{value:!0});V_.calculateBaseline=oU;function oU(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2,c=s+i+r+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=V_;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(Hk);var Uk={},W_={},G_={},Y_={};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.isContentEditable=rU;function rU(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=Y_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(G_);Object.defineProperty(W_,"__esModule",{value:!0});W_.canSetCaret=aU;var iU=ms,sU=G_;function aU(t){var e=!0;if((0,iU.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,sU.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=W_;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(Uk);var hp={},q_={};function lU(t,e,n){let o=n.value!==void 0?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}function Kk(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function J_(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function cU(t){return!J_(t)}var dU=()=>typeof window<"u"&&window.navigator!==null&&J_(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function uU(t){let e=Kk();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function pU(t){return t[0].toUpperCase()+t.slice(1)}function fU(t){let e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);let n=window.getSelection(),o=document.createRange();if(o.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(o),document.execCommand("copy"),document.body.removeChild(e)}function hU(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=void 0,n!==!0&&t.apply(i,r)},a=n===!0&&o!==void 0;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function fi(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function gU(t){return fi(t)==="boolean"}function jk(t){return fi(t)==="function"||fi(t)==="asyncfunction"}function mU(t){return jk(t)&&/^\s*class\s+/.test(t.toString())}function _U(t){return fi(t)==="number"}function Gu(t){return fi(t)==="object"}function bU(t){return Promise.resolve(t)===t}function yU(t){return fi(t)==="string"}function xU(t){return fi(t)==="undefined"}function f_(t,...e){if(!e.length)return t;let n=e.shift();if(Gu(t)&&Gu(n))for(let o in n)Gu(n[o])?(t[o]===void 0&&Object.assign(t,{[o]:{}}),f_(t[o],n[o])):Object.assign(t,{[o]:n[o]});return f_(t,...e)}function vU(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&console.warn(o)}function CU(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function EU(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}var wU={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},TU={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4},SU=class{constructor(){this.completed=Promise.resolve()}add(t){return new Promise((e,n)=>{this.completed=this.completed.then(t).then(e).catch(n)})}};function kU(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s===null&&(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s===null&&(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}var NU=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:SU,beautifyShortcut:uU,cacheable:lU,capitalize:pU,copyTextToClipboard:fU,debounce:hU,deepMerge:f_,deprecationAssert:vU,getUserOS:Kk,getValidUrl:CU,isBoolean:gU,isClass:mU,isEmpty:cU,isFunction:jk,isIosDevice:dU,isNumber:_U,isObject:Gu,isPrintableKey:EU,isPromise:bU,isString:yU,isUndefined:xU,keyCodes:wU,mouseButtons:TU,notEmpty:J_,throttle:kU,typeOf:fi},Symbol.toStringTag,{value:"Module"})),X_=W4(NU);Object.defineProperty(q_,"__esModule",{value:!0});q_.containsOnlyInlineElements=IU;var DU=X_,OU=K_;function IU(t){var e;(0,DU.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(o){return!(0,OU.blockElements)().includes(o.tagName.toLowerCase())&&Array.from(o.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=q_;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(hp);var Vk={},Z_={},gp={},Q_={};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.make=AU;function AU(t,e,n){var o;e===void 0&&(e=null),n===void 0&&(n={});var r=document.createElement(t);if(Array.isArray(e)){var i=e.filter(function(a){return a!==void 0});(o=r.classList).add.apply(o,i)}else e!==null&&r.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s]);return r}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=Q_;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(gp);Object.defineProperty(Z_,"__esModule",{value:!0});Z_.fragmentToString=LU;var MU=gp;function LU(t){var e=(0,MU.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=Z_;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(Vk);var Wk={},eb={};Object.defineProperty(eb,"__esModule",{value:!0});eb.getContentLength=PU;var RU=ms;function PU(t){var e,n;return(0,RU.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=eb;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(Wk);var tb={},nb={},sk=_c&&_c.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(nb,"__esModule",{value:!0});nb.getDeepestBlockElements=Gk;var FU=hp;function Gk(t){return(0,FU.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return sk(sk([],e,!0),Gk(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=nb;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(tb);var Yk={},ob={},mp={},rb={};Object.defineProperty(rb,"__esModule",{value:!0});rb.isLineBreakTag=BU;function BU(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=rb;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(mp);var _p={},ib={};Object.defineProperty(ib,"__esModule",{value:!0});ib.isSingleTag=$U;function $U(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=ib;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(_p);Object.defineProperty(ob,"__esModule",{value:!0});ob.getDeepestNode=qk;var zU=ms,HU=mp,UU=_p;function qk(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",o=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var r=t[n];if((0,UU.isSingleTag)(r)&&!(0,zU.isNativeInput)(r)&&!(0,HU.isLineBreakTag)(r))if(r[o])r=r[o];else if(r.parentNode!==null&&r.parentNode[o])r=r.parentNode[o];else return r.parentNode;return qk(r,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=ob;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(Yk);var Jk={},sb={},Hu=_c&&_c.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(sb,"__esModule",{value:!0});sb.findAllInputs=GU;var KU=hp,jU=tb,VU=$_,WU=ms;function GU(t){return Array.from(t.querySelectorAll((0,VU.allInputsSelector)())).reduce(function(e,n){return(0,WU.isNativeInput)(n)||(0,KU.containsOnlyInlineElements)(n)?Hu(Hu([],e,!0),[n],!1):Hu(Hu([],e,!0),(0,jU.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=sb;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(Jk);var Xk={},ab={};Object.defineProperty(ab,"__esModule",{value:!0});ab.isCollapsedWhitespaces=YU;function YU(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=ab;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(Xk);var lb={},cb={};Object.defineProperty(cb,"__esModule",{value:!0});cb.isElement=JU;var qU=X_;function JU(t){return(0,qU.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=cb;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(lb);var Zk={},db={},ub={},pb={};Object.defineProperty(pb,"__esModule",{value:!0});pb.isLeaf=XU;function XU(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=pb;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(ub);var fb={},hb={};Object.defineProperty(hb,"__esModule",{value:!0});hb.isNodeEmpty=n6;var ZU=mp,QU=lb,e6=ms,t6=_p;function n6(t,e){var n="";return(0,t6.isSingleTag)(t)&&!(0,ZU.isLineBreakTag)(t)?!1:((0,QU.isElement)(t)&&(0,e6.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("\u200B","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=hb;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(fb);Object.defineProperty(db,"__esModule",{value:!0});db.isEmpty=i6;var o6=ub,r6=fb;function i6(t,e){t.normalize();for(var n=[t];n.length>0;){var o=n.shift();if(o){if(t=o,(0,o6.isLeaf)(t)&&!(0,r6.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=db;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(Zk);var Qk={},gb={};Object.defineProperty(gb,"__esModule",{value:!0});gb.isFragment=a6;var s6=X_;function a6(t){return(0,s6.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=gb;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(Qk);var eN={},mb={};Object.defineProperty(mb,"__esModule",{value:!0});mb.isHTMLString=c6;var l6=gp;function c6(t){var e=(0,l6.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=mb;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(eN);var tN={},_b={};Object.defineProperty(_b,"__esModule",{value:!0});_b.offset=d6;function d6(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,r=e.top+o,i=e.left+n;return{top:r,left:i,bottom:r+e.height,right:i+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=_b;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(tN);var nN={},bb={};Object.defineProperty(bb,"__esModule",{value:!0});bb.prepend=u6;function u6(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=bb;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(nN);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=$_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=ms;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var o=zk;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return o.append}});var r=K_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return r.blockElements}});var i=Hk;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return i.calculateBaseline}});var s=Uk;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=hp;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=Vk;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=Wk;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var d=tb;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return d.getDeepestBlockElements}});var u=Yk;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return u.getDeepestNode}});var p=Jk;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var h=Xk;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return h.isCollapsedWhitespaces}});var g=G_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return g.isContentEditable}});var m=lb;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return m.isElement}});var _=Zk;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var b=Qk;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return b.isFragment}});var y=eN;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return y.isHTMLString}});var v=ub;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return v.isLeaf}});var x=fb;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return x.isNodeEmpty}});var C=mp;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return C.isLineBreakTag}});var E=_p;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return E.isSingleTag}});var k=gp;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return k.make}});var T=tN;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return T.offset}});var w=nN;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return w.prepend}})})(gs);var bp={};Object.defineProperty(bp,"__esModule",{value:!0});bp.getContenteditableSlice=f6;var p6=gs;function f6(t,e,n,o,r){var i;r===void 0&&(r=!1);var s=document.createRange();if(o==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),r===!0){var a=s.extractContents();return(0,p6.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var d=(i=c.textContent)!==null&&i!==void 0?i:"";return d}Object.defineProperty(fp,"__esModule",{value:!0});fp.checkContenteditableSliceForEmptiness=m6;var h6=gs,g6=bp;function m6(t,e,n,o){var r=(0,g6.getContenteditableSlice)(t,e,n,o);return(0,h6.isCollapsedWhitespaces)(r)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=fp;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(B_);var oN={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=bp;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(oN);var rN={},yb={};Object.defineProperty(yb,"__esModule",{value:!0});yb.focus=b6;var _6=gs;function b6(t,e){var n,o;if(e===void 0&&(e=!0),(0,_6.isNativeInput)(t)){t.focus();var r=e?0:t.value.length;t.setSelectionRange(r,r)}else{var i=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p){var h=document.createTextNode("");p.appendChild(h),i.setStart(h,0),i.setEnd(h,0)},l=function(p){return p!=null},c=t.childNodes,d=e?c[0]:c[c.length-1];if(l(d)){for(;l(d)&&d.nodeType!==Node.TEXT_NODE;)d=e?d.firstChild:d.lastChild;if(l(d)&&d.nodeType===Node.TEXT_NODE){var u=(o=(n=d.textContent)===null||n===void 0?void 0:n.length)!==null&&o!==void 0?o:0,r=e?0:u;i.setStart(d,r),i.setEnd(d,r)}else a(t)}else a(t);s.removeAllRanges(),s.addRange(i)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=yb;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(rN);var xb={},yp={};Object.defineProperty(yp,"__esModule",{value:!0});yp.getCaretNodeAndOffset=y6;function y6(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=yp;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(xb);var iN={},xp={};Object.defineProperty(xp,"__esModule",{value:!0});xp.getRange=x6;function x6(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=xp;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(iN);var sN={},vb={};Object.defineProperty(vb,"__esModule",{value:!0});vb.isCaretAtEndOfInput=E6;var ak=gs,v6=xb,C6=B_;function E6(t){var e=(0,ak.getDeepestNode)(t,!0);if(e===null)return!0;if((0,ak.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,v6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,C6.checkContenteditableSliceForEmptiness)(t,o,r,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=vb;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(sN);var aN={},Cb={};Object.defineProperty(Cb,"__esModule",{value:!0});Cb.isCaretAtStartOfInput=S6;var Uu=gs,w6=yp,T6=fp;function S6(t){var e=(0,Uu.getDeepestNode)(t);if(e===null||(0,Uu.isEmpty)(t))return!0;if((0,Uu.isNativeInput)(e))return e.selectionEnd===0;if((0,Uu.isEmpty)(t))return!0;var n=(0,w6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,T6.checkContenteditableSliceForEmptiness)(t,o,r,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=Cb;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(aN);var lN={},Eb={};Object.defineProperty(Eb,"__esModule",{value:!0});Eb.save=D6;var k6=gs,N6=xp;function D6(){var t=(0,N6.getRange)(),e=(0,k6.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=Eb;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(lN);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=B_;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=oN;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var o=rN;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return o.focus}});var r=xb;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return r.getCaretNodeAndOffset}});var i=iN;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return i.getRange}});var s=sN;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=aN;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=lN;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})($k);var h_=class extends Le{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case we.BACKSPACE:this.backspace(e);break;case we.DELETE:this.delete(e);break;case we.ENTER:this.enter(e);break;case we.DOWN:case we.RIGHT:this.arrowRightAndDown(e);break;case we.UP:case we.LEFT:this.arrowLeftAndUp(e);break;case we.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&pk(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!0}dragLeave(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!1}handleCommandC(e){let{BlockSelection:n}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e)}handleCommandX(e){let{BlockSelection:n,BlockManager:o,Caret:r}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e).then(()=>{let i=o.removeSelectedBlocks(),s=o.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),n.clearSelection(e)})}tabPressed(e){let{InlineToolbar:n,Caret:o}=this.Editor;n.opened||(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){this.Editor.BlockManager.currentBlock.isEmpty&&(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){let{BlockManager:n,UI:o}=this.Editor,r=n.currentBlock;if(r===void 0||r.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!Pm)return;let i=r;r.currentInput!==void 0&&Vu(r.currentInput)&&!r.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):r.currentInput&&Wu(r.currentInput)?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,previousBlock:i}=n;if(!(r===void 0||!_e.isCollapsed||!r.currentInput||!Vu(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.firstInput){o.navigatePrevious();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r);let s=n.currentBlock;o.setToBlock(s,o.positions.END);return}tk(i,r)?this.mergeBlocks(i,r):o.setToBlock(i,o.positions.END)}}}delete(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,nextBlock:i}=n;if(!(!_e.isCollapsed||!Wu(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.lastInput){o.navigateNext();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r),o.setToBlock(i,o.positions.START);return}tk(r,i)?this.mergeBlocks(r,i):o.setToBlock(i,o.positions.START)}}}mergeBlocks(e,n){let{BlockManager:o,Toolbar:r}=this.Editor;e.lastInput!==void 0&&($k.focus(e.lastInput,!1),o.mergeBlocks(e,n).then(()=>{r.close()}))}arrowRightAndDown(e){let n=wa.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===we.TAB);if(this.Editor.UI.someToolbarOpened&&n)return;this.Editor.Toolbar.close();let{currentBlock:o}=this.Editor.BlockManager,r=(o?.currentInput!==void 0?Wu(o.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===we.DOWN&&r){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===we.DOWN||e.keyCode===we.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}Yu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(wa.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===we.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();let{currentBlock:n}=this.Editor.BlockManager,o=(n?.currentInput!==void 0?Vu(n.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===we.UP&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===we.UP||e.keyCode===we.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}Yu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){let n=e.keyCode===we.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===we.ENTER&&this.Editor.BlockSettings.opened,r=e.keyCode===we.ENTER&&this.Editor.InlineToolbar.opened,i=e.keyCode===we.TAB;return!(e.shiftKey||i||n||o||r)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}},mc=class{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return fk(this.workingArea.children)}static set(e,n,o){return isNaN(Number(n))?(Reflect.set(e,n,o),!0):(e.insert(+n,o),!0)}static get(e,n){return isNaN(Number(n))?Reflect.get(e,n):e.get(+n)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,n){let o=this.blocks[n];U.swap(this.blocks[e].holder,o.holder),this.blocks[n]=this.blocks[e],this.blocks[e]=o}move(e,n){let o=this.blocks.splice(n,1)[0],r=e-1,i=Math.max(0,r),s=this.blocks[i];e>0?this.insertToDOM(o,"afterend",s):this.insertToDOM(o,"beforebegin",s),this.blocks.splice(e,0,o);let a=this.composeBlockEvent("move",{fromIndex:n,toIndex:e});o.call(kr.MOVED,a)}insert(e,n,o=!1){if(!this.length){this.push(n);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(kr.REMOVED));let r=o?1:0;if(this.blocks.splice(e,r,n),e>0){let i=this.blocks[e-1];this.insertToDOM(n,"afterend",i)}else{let i=this.blocks[e+1];i?this.insertToDOM(n,"beforebegin",i):this.insertToDOM(n)}}replace(e,n){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(n.holder),this.blocks[e]=n}insertMany(e,n){let o=new DocumentFragment;for(let r of e)o.appendChild(r.holder);if(this.length>0){if(n>0){let r=Math.min(n-1,this.length-1);this.blocks[r].holder.after(o)}else n===0&&this.workingArea.prepend(o);this.blocks.splice(n,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(r=>r.call(kr.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(kr.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(kr.REMOVED)),this.blocks.length=0}insertAfter(e,n){let o=this.blocks.indexOf(e);this.insert(o+1,n)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,n,o){n?o.holder.insertAdjacentElement(n,e.holder):this.workingArea.appendChild(e.holder),e.call(kr.RENDERED)}composeBlockEvent(e,n){return new CustomEvent(e,{detail:n})}},lk="block-removed",ck="block-added",O6="block-moved",dk="block-changed",g_=class{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,o)=>{this.completed=this.completed.then(e).then(n).catch(o)})}},m_=class extends Le{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){let e=new mc(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:mc.set,get:mc.get}),this.listeners.on(document,"copy",n=>this.Editor.BlockEvents.handleCommandC(n))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:n={},id:o=void 0,tunes:r={}}){let i=this.Editor.ReadOnly.isEnabled,s=this.Editor.Tools.blockTools.get(e),a=new Do({id:o,data:n,tool:s,api:this.Editor.API,readOnly:i,tunesData:r},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:n=this.config.defaultBlock,data:o={},index:r,needToFocus:i=!0,replace:s=!1,tunes:a={}}={}){let l=r;l===void 0&&(l=this.currentBlockIndex+(s?0:1));let c=this.composeBlock({id:e,tool:n,data:o,tunes:a});return s&&this.blockDidMutated(lk,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,s),this.blockDidMutated(ck,c,{index:l}),i?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(e,n=0){this._blocks.insertMany(e,n)}async update(e,n,o){if(!n&&!o)return e;let r=await e.data,i=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},r,n??{}),tunes:o??e.tunes}),s=this.getBlockIndex(e);return this._blocks.replace(s,i),this.blockDidMutated(dk,i,{index:s}),i}replace(e,n,o){let r=this.getBlockIndex(e);return this.insert({tool:n,data:o,index:r,replace:!0})}paste(e,n,o=!1){let r=this.insert({tool:e,replace:o});try{window.requestIdleCallback(()=>{r.call(kr.ON_PASTE,n)})}catch(i){We(`${e}: onPaste callback call is failed`,"error",i)}return r}insertDefaultBlockAtIndex(e,n=!1){let o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(ck,o,{index:e}),n?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,n){let o;if(e.name===n.name&&e.mergeable){let r=await n.data;if(vo(r)){console.error("Could not merge Block. Failed to extract original Block data.");return}let[i]=M_([r],e.tool.sanitizeConfig);o=i}else if(e.mergeable&&Xu(n,"export")&&Xu(e,"import")){let r=await n.exportDataAsString(),i=Zo(r,e.tool.sanitizeConfig);o=nk(i,e.tool.conversionConfig)}o!==void 0&&(await e.mergeWith(o),this.removeBlock(n),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,n=!0){return new Promise(o=>{let r=this._blocks.indexOf(e);if(!this.validateIndex(r))throw new Error("Can't find a Block to remove");e.destroy(),this._blocks.remove(r),this.blockDidMutated(lk,e,{index:r}),this.currentBlockIndex>=r&&this.currentBlockIndex--,this.blocks.length?r===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),n&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let n=this.blocks.length-1;n>=0;n--)this.blocks[n].selected&&(this.removeBlock(this.blocks[n]),e=n);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){let e=this.Editor.Caret.extractFragmentFromCaretPosition(),n=U.make("div");n.appendChild(e);let o={text:U.isEmpty(n)?"":n.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(n=>n.id===e)}getBlock(e){U.isElement(e)||(e=e.parentNode);let n=this._blocks.nodes,o=e.closest(`.${Do.CSS.wrapper}`),r=n.indexOf(o);if(r>=0)return this._blocks[r]}setCurrentBlockByChildNode(e){U.isElement(e)||(e=e.parentNode);let n=e.closest(`.${Do.CSS.wrapper}`);if(!n)return;let o=n.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(n),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;U.isElement(e)||(e=e.parentNode);let n=e.closest(`.${Do.CSS.wrapper}`);return this.blocks.find(o=>o.holder===n)}swap(e,n){this._blocks.swap(e,n),this.currentBlockIndex=n}move(e,n=this.currentBlockIndex){if(isNaN(e)||isNaN(n)){We("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(n)){We("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,n),this.currentBlockIndex=e,this.blockDidMutated(O6,this.currentBlock,{fromIndex:n,toIndex:e})}async convert(e,n,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");let r=this.Editor.Tools.blockTools.get(n);if(!r)throw new Error(`Could not convert Block. Tool \xAB${n}\xBB not found.`);let i=await e.exportDataAsString(),s=Zo(i,r.sanitizeConfig),a=nk(s,r.conversionConfig,r.settings);return o&&(a=Object.assign(a,o)),this.replace(e,r.name,a)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){let n=new g_;this.blocks.forEach(o=>{n.add(async()=>{await this.removeBlock(o,!1)})}),await n.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){let{BlockEvents:n}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{n.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{n.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{n.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{n.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(dk,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,n,o){let r=new CustomEvent(e,{detail:{target:new Sr(n),...o}});return this.eventsDispatcher.emit(bk,{event:r}),n}},__=class extends Le{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){let{BlockManager:e}=this.Editor;return e.blocks.every(n=>n.selected===!0)}set allBlocksSelected(e){let{BlockManager:n}=this.Editor;n.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){let{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(n=>n.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new _e,Ta.add({name:"CMD+A",handler:e=>{let{BlockManager:n,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}n.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){_e.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){let{BlockManager:n}=this.Editor,o;isNaN(e)?o=n.currentBlock:o=n.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,n=!1){let{BlockManager:o,Caret:r,RectangleSelection:i}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;let s=e&&e instanceof KeyboardEvent,a=s&&pk(e.keyCode);if(this.anyBlockSelected&&s&&a&&!_e.isSelectionExists){let l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),r.setToBlock(o.currentBlock),Yu(()=>{let c=e.key;r.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||i.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}n&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();let n=U.make("div");this.selectedBlocks.forEach(i=>{let s=Zo(i.holder.innerHTML,this.sanitizerConfig),a=U.make("p");a.innerHTML=s,n.appendChild(a)});let o=Array.from(n.childNodes).map(i=>i.textContent).join(`
101
+
102
+ `),r=n.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",r),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){let{BlockManager:n}=this.Editor,o=n.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),_e.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){Ta.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),U.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}let n=this.Editor.BlockManager.getBlock(e.target),o=n.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(n),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),_e.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}},b_=class t extends Le{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,n=this.positions.DEFAULT,o=0){var r;let{BlockManager:i,BlockSelection:s}=this.Editor;if(s.clearSelection(),!e.focusable){(r=window.getSelection())==null||r.removeAllRanges(),s.selectBlock(e),i.currentBlock=e;return}let a;switch(n){case this.positions.START:a=e.firstInput;break;case this.positions.END:a=e.lastInput;break;default:a=e.currentInput}if(!a)return;let l=U.getDeepestNode(a,n===this.positions.END),c=U.getContentLength(l);switch(!0){case n===this.positions.START:o=0;break;case n===this.positions.END:case o>c:o=c;break}this.set(l,o),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=a}setToInput(e,n=this.positions.DEFAULT,o=0){let{currentBlock:r}=this.Editor.BlockManager,i=U.getDeepestNode(e);switch(n){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,U.getContentLength(i));break;default:o&&this.set(i,o)}r.currentInput=e}set(e,n=0){let{top:o,bottom:r}=_e.setCursor(e,n),{innerHeight:i}=window;o<0?window.scrollBy(0,o-30):r>i&&window.scrollBy(0,r-i+30)}setToTheLastBlock(){let e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{let n=this.Editor.BlockManager.insertAtEnd();this.setToBlock(n)}}extractFragmentFromCaretPosition(){let e=_e.get();if(e.rangeCount){let n=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(n.deleteContents(),o)if(U.isNativeInput(o)){let r=o,i=document.createDocumentFragment(),s=r.value.substring(0,r.selectionStart),a=r.value.substring(r.selectionStart);return i.textContent=a,r.value=s,i}else{let r=n.cloneRange();return r.selectNodeContents(o),r.setStart(n.endContainer,n.endOffset),r.extractContents()}}}navigateNext(e=!1){let{BlockManager:n}=this.Editor,{currentBlock:o,nextBlock:r}=n;if(o===void 0)return!1;let{nextInput:i,currentInput:s}=o,a=s!==void 0?Wu(s):void 0,l=r,c=e||a||!o.focusable;if(i&&c)return this.setToInput(i,this.positions.START),!0;if(l===null){if(o.tool.isDefault||!c)return!1;l=n.insertAtEnd()}return c?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){let{currentBlock:n,previousBlock:o}=this.Editor.BlockManager;if(!n)return!1;let{previousInput:r,currentInput:i}=n,s=i!==void 0?Vu(i):void 0,a=e||s||!n.focusable;return r&&a?(this.setToInput(r,this.positions.END),!0):o!==null&&a?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){let n=document.createElement("span");n.classList.add(t.CSS.shadowCaret),e.insertAdjacentElement("beforeend",n)}restoreCaret(e){let n=e.querySelector(`.${t.CSS.shadowCaret}`);if(!n)return;new _e().expandToTag(n);let o=document.createRange();o.selectNode(n),o.extractContents()}insertContentAtCaretPosition(e){let n=document.createDocumentFragment(),o=document.createElement("div"),r=_e.get(),i=_e.range;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>n.appendChild(c)),n.childNodes.length===0&&n.appendChild(new Text);let s=n.lastChild;i.deleteContents(),i.insertNode(n);let a=document.createRange(),l=s.nodeType===Node.TEXT_NODE?s:s.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),r.removeAllRanges(),r.addRange(a)}},y_=class extends Le{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{let{BlockManager:n,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;let r=n.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=n.getBlockByChildNode(e.target);if(!(!r||!i)&&i!==r){if(r===this.firstSelectedBlock){_e.get().removeAllRanges(),r.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){r.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(r,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==Y4.LEFT)return;let{BlockManager:n}=this.Editor;this.firstSelectedBlock=n.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){let{BlockManager:n,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=n.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),_e.get().removeAllRanges());let r=n.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=n.blocks[r];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor,i=n.blocks.indexOf(this.firstSelectedBlock),s=n.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&s>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case we.DOWN:case we.RIGHT:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END);break;case we.UP:case we.LEFT:r.setToBlock(n.blocks[Math.min(i,s)],r.positions.START);break;default:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){let{UI:n}=this.Editor;_e.isCollapsed||this.Editor.BlockSelection.clearSelection(e),n.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,n){let{BlockManager:o,BlockSelection:r}=this.Editor,i=o.blocks.indexOf(e),s=o.blocks.indexOf(n),a=e.selected!==n.selected;for(let l=Math.min(i,s);l<=Math.max(i,s);l++){let c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(a?e:n)&&(o.blocks[l].selected=!o.blocks[l].selected,r.clearCache())}}},x_=class extends Le{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){let{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async n=>{await this.processDrop(n)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",n=>{this.processDragOver(n)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){let{BlockManager:n,Paste:o,Caret:r}=this.Editor;e.preventDefault(),n.blocks.forEach(s=>{s.dropTarget=!1}),_e.isAtEditor&&!_e.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;let i=n.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,r.positions.END);else{let s=n.setCurrentBlockByChildNode(n.lastBlock.holder);this.Editor.Caret.setToBlock(s,r.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){_e.isAtEditor&&!_e.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}},I6=180,A6=400,v_=class extends Le{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=A6,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(bk,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(yk,()=>{this.disable()}),this.eventsDispatcher.on(xk,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!ht(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let n;this.batchingOnChangeQueue.size===1?n=this.batchingOnChangeQueue.values().next().value:n=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,n),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(Fm,{mutations:e})}},cN=class dN extends Le{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{let n=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!ht(n.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(n){We(`Paste handling for \xAB${e.name}\xBB Tool hasn't been set up because of the error`,"warn",n)}},this.handlePasteEvent=async e=>{let{BlockManager:n,Toolbar:o}=this.Editor,r=n.setCurrentBlockByChildNode(e.target);!r||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||r&&this.exceptionList.includes(r.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,n=!1){let{Tools:o}=this.Editor,r=e.types;if((r.includes?r.includes("Files"):r.contains("Files"))&&!vo(this.toolsFiles)){await this.processFiles(e.files);return}let i=e.getData(this.MIME_TYPE),s=e.getData("text/plain"),a=e.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}n&&s.trim()&&a.trim()&&(a="<p>"+(a.trim()?a:s)+"</p>");let l=Object.keys(this.toolsTags).reduce((u,p)=>(u[p.toLowerCase()]=this.toolsTags[p].sanitizationConfig??{},u),{}),c=Object.assign({},l,o.getAllInlineToolsSanitizeConfig(),{br:{}}),d=Zo(a,c);!d.trim()||d.trim()===s||!U.isHTMLString(d)?await this.processText(s):await this.processText(d,!0)}async processText(e,n=!1){let{Caret:o,BlockManager:r}=this.Editor,i=n?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}let s=r.currentBlock&&r.currentBlock.tool.isDefault&&r.currentBlock.isEmpty;i.map(async(a,l)=>this.insertBlock(a,l===0&&s)),r.currentBlock&&o.setToBlock(r.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){let e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return Dr(e)?[e]:an(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;let n=e.pasteConfig.tags||[],o=[];n.forEach(r=>{let i=this.collectTagNames(r);o.push(...i),i.forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,s)){We(`Paste handler for \xAB${e.name}\xBB Tool on \xAB${s}\xBB tag is skipped because it is already used by \xAB${this.toolsTags[s].tool.name}\xBB Tool.`,"warn");return}let a=an(r)?r[s]:null;this.toolsTags[s.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=o.map(r=>r.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;let{files:n={}}=e.pasteConfig,{extensions:o,mimeTypes:r}=n;!o&&!r||(o&&!Array.isArray(o)&&(We(`\xABextensions\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),o=[]),r&&!Array.isArray(r)&&(We(`\xABmimeTypes\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),r=[]),r&&(r=r.filter(i=>Q4(i)?!0:(We(`MIME type value \xAB${i}\xBB for the \xAB${e.name}\xBB Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:r||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||vo(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([n,o])=>{o instanceof RegExp||We(`Pattern ${o} for \xAB${e.name}\xBB Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:n,pattern:o,tool:e})})}isNativeBehaviour(e){return U.isNativeInput(e)}async processFiles(e){let{BlockManager:n}=this.Editor,o;o=await Promise.all(Array.from(e).map(i=>this.processFile(i))),o=o.filter(i=>!!i);let r=n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty;o.forEach((i,s)=>{n.paste(i.type,i.event,s===0&&r)})}async processFile(e){let n=Z4(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:s,extensions:a}])=>{let[l,c]=e.type.split("/"),d=a.find(p=>p.toLowerCase()===n.toLowerCase()),u=s.find(p=>{let[h,g]=p.split("/");return h===l&&(g===c||g==="*")});return!!d||!!u});if(!o)return;let[r]=o;return{event:this.composePasteEvent("file",{file:e}),type:r}}processHTML(e){let{Tools:n}=this.Editor,o=U.make("DIV");return o.innerHTML=e,this.getNodes(o).map(r=>{let i,s=n.defaultTool,a=!1;switch(r.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=U.make("div"),i.appendChild(r);break;case Node.ELEMENT_NODE:i=r,a=!0,this.toolsTags[i.tagName]&&(s=this.toolsTags[i.tagName].tool);break}let{tags:l}=s.pasteConfig||{tags:[]},c=l.reduce((p,h)=>(this.collectTagNames(h).forEach(g=>{let m=an(h)?h[g]:null;p[g.toLowerCase()]=m||{}}),p),{}),d=Object.assign({},c,s.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){let p=Zo(i.outerHTML,d);i=U.make("div",void 0,{innerHTML:p}).firstChild}else i.innerHTML=Zo(i.innerHTML,d);let u=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:a,tool:s.name,event:u}}).filter(r=>{let i=U.isEmpty(r.content),s=U.isSingleTag(r.content);return!i||s})}processPlain(e){let{defaultBlock:n}=this.config;if(!e)return[];let o=n;return e.split(/\r?\n/).filter(r=>r.trim()).map(r=>{let i=U.make("div");i.textContent=r;let s=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:s}})}async processSingleBlock(e){let{Caret:n,BlockManager:o}=this.Editor,{currentBlock:r}=o;if(!r||e.tool!==r.name||!U.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,r?.tool.isDefault&&r.isEmpty);return}n.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){let{BlockManager:n,Caret:o}=this.Editor,{content:r}=e;if(n.currentBlock&&n.currentBlock.tool.isDefault&&r.textContent.length<dN.PATTERN_PROCESSING_MAX_LENGTH){let i=await this.processPattern(r.textContent);if(i){let s=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty,a=n.paste(i.tool,i.event,s);o.setToBlock(a,o.positions.END);return}}if(n.currentBlock&&n.currentBlock.currentInput){let i=n.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,Zo(r.innerHTML,i))}else this.insertBlock(e)}async processPattern(e){let n=this.toolsPatterns.find(o=>{let r=o.pattern.exec(e);return r?e===r.shift():!1});return n?{event:this.composePasteEvent("pattern",{key:n.key,data:e}),tool:n.tool.name}:void 0}insertBlock(e,n=!1){let{BlockManager:o,Caret:r}=this.Editor,{currentBlock:i}=o,s;if(n&&i&&i.isEmpty){s=o.paste(e.tool,e.event,!0),r.setToBlock(s,r.positions.END);return}s=o.paste(e.tool,e.event),r.setToBlock(s,r.positions.END)}insertEditorJSData(e){let{BlockManager:n,Caret:o,Tools:r}=this.Editor;M_(e,i=>r.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:s},a)=>{let l=!1;a===0&&(l=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty);let c=n.insert({tool:i,data:s,replace:l});o.setToBlock(c,o.positions.END)})}processElementNode(e,n,o){let r=Object.keys(this.toolsTags),i=e,{tool:s}=this.toolsTags[i.tagName]||{},a=this.tagsByTool[s?.name]||[],l=r.includes(i.tagName),c=U.blockElements.includes(i.tagName.toLowerCase()),d=Array.from(i.children).some(({tagName:p})=>r.includes(p)&&!a.includes(p)),u=Array.from(i.children).some(({tagName:p})=>U.blockElements.includes(p.toLowerCase()));if(!c&&!l&&!d)return o.appendChild(i),[...n,o];if(l&&!d||c&&!u&&!d)return[...n,o,i]}getNodes(e){let n=Array.from(e.childNodes),o,r=(i,s)=>{if(U.isEmpty(s)&&!U.isSingleTag(s))return i;let a=i[i.length-1],l=new DocumentFragment;switch(a&&U.isFragment(a)&&(l=i.pop()),s.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(s,i,l),o)return o;break;case Node.TEXT_NODE:return l.appendChild(s),[...i,l];default:return[...i,l]}return[...i,...Array.from(s.childNodes).reduce(r,[])]};return n.reduce(r,[])}composePasteEvent(e,n){return new CustomEvent(e,{detail:n})}};cN.PATTERN_PROCESSING_MAX_LENGTH=450;var M6=cN,C_=class extends Le{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){let{Tools:e}=this.Editor,{blockTools:n}=e,o=[];Array.from(n.entries()).forEach(([r,i])=>{i.isReadOnlySupported||o.push(r)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,n=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();let o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(let i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(n)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();let r=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(r.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new Ju(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}},E_=class t extends Le{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,n){let o=document.elementFromPoint(e-window.pageXOffset,n-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);let r=[`.${Do.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],i=o.closest("."+this.Editor.UI.CSS.editorWrapper),s=r.some(a=>!!o.closest(a));!i||s||(this.mousedown=!0,this.startX=e,this.startY=n)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){let{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1),this.listeners.on(document.body,"mousemove",Mm(n=>{this.processMouseMove(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",Mm(n=>{this.processScroll(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(U.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){let{UI:e}=this.Editor,n=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=U.make("div",t.CSS.overlay,{}),r=U.make("div",t.CSS.overlayContainer,{}),i=U.make("div",t.CSS.rect,{});return r.appendChild(i),o.appendChild(r),n.appendChild(o),this.overlayRectangle=i,{container:n,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;let n=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-n,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);let{rightPos:n,leftPos:o,index:r}=this.genInfoForMouseSelection(),i=this.startX>n&&this.mouseX>n,s=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(i||s),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),r!==void 0&&(this.trySelectNextBlock(r),this.inverseSelection(),_e.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){let e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(n);if(!this.rectCrossesBlocks&&e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(n)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){let e=document.body.offsetWidth/2,n=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,n),r=this.Editor.BlockManager.getBlockByChildNode(o),i;r!==void 0&&(i=this.Editor.BlockManager.blocks.findIndex(d=>d.holder===r.holder));let s=this.Editor.BlockManager.lastBlock.holder.querySelector("."+Do.CSS.content),a=Number.parseInt(window.getComputedStyle(s).width,10)/2,l=e-a,c=e+a;return{index:i,leftPos:l,rightPos:c}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){let n=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,r=1,i=-1,s=0;if(n)return;let a=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0,l=s;o>1&&(l=a?r:i);let c=e>this.stackOfSelected[o-1]&&l===r,d=e<this.stackOfSelected[o-1]&&l===i,u=!(c||d||l===s);if(!u&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let g=this.stackOfSelected[o-1]+1||e;for(g;g<=e;g++)this.addBlockInSelection(g);return}if(!u&&e<this.stackOfSelected[o-1]){for(let g=this.stackOfSelected[o-1]-1;g>=e;g--)this.addBlockInSelection(g);return}if(!u)return;let p=o-1,h;for(e>this.stackOfSelected[o-1]?h=()=>e>this.stackOfSelected[p]:h=()=>e<this.stackOfSelected[p];h();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[p]),this.stackOfSelected.pop(),p--}},w_=class extends Le{async render(e){return new Promise(n=>{let{Tools:o,BlockManager:r}=this.Editor;if(e.length===0)r.insert();else{let i=e.map(({type:s,data:a,tunes:l,id:c})=>{o.available.has(s)===!1&&(xo(`Tool \xAB${s}\xBB is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(s,a,c),s=o.stubTool);let d;try{d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}catch(u){We(`Block \xAB${s}\xBB skipped because of plugins error`,"error",{data:a,error:u}),a=this.composeStubDataForTool(s,a,c),s=o.stubTool,d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}return d});r.insertMany(i)}window.requestIdleCallback(()=>{n()},{timeout:2e3})})}composeStubDataForTool(e,n,o){let{Tools:r}=this.Editor,i=e;if(r.unavailable.has(e)){let s=r.unavailable.get(e).toolbox;s!==void 0&&s[0].title!==void 0&&(i=s[0].title)}return{savedData:{id:o,type:e,data:n},title:i}}},T_=class extends Le{async save(){let{BlockManager:e,Tools:n}=this.Editor,o=e.blocks,r=[];try{o.forEach(a=>{r.push(this.getSavedData(a))});let i=await Promise.all(r),s=await M_(i,a=>n.blockTools.get(a).sanitizeConfig);return this.makeOutput(s)}catch(i){xo("Saving failed due to the Error %o","error",i)}}async getSavedData(e){let n=await e.save(),o=n&&await e.validate(n.data);return{...n,isValid:o}}makeOutput(e){let n=[];return e.forEach(({id:o,tool:r,data:i,tunes:s,isValid:a})=>{if(!a){We(`Block \xAB${r}\xBB skipped because saved data is invalid`);return}if(r===this.Editor.Tools.stubTool){n.push(i);return}let l={id:o,type:r,data:i,...!vo(s)&&{tunes:s}};n.push(l)}),{time:+new Date,blocks:n,version:"2.31.0-rc.7"}}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var L6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function R6(t){let e=document.createElement("div");e.innerHTML=t.trim();let n=document.createDocumentFragment();return n.append(...Array.from(e.childNodes)),n}var S_=class t{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=n.placeholder?n.placeholder:t.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=n.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;let{textContent:n}=this._element;n===""&&(this._element.innerHTML="")}drawView(){let e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;let n=R6(e.text);this._element.appendChild(n),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){let n={text:e.detail.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:L6,title:"Text"}}},vc=class{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:N5,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}};vc.isInline=!0;vc.title="Bold";var Cc=class{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=R5,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){let e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}};Cc.isInline=!0;Cc.title="Italic";var Ec=class{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new _e}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=ok,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());let n=this.selection.findParentTag("A");if(n){this.selection.expandToTag(n),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close();return}}this.toggleActions()}checkState(){let e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=$5,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();let n=e.getAttribute("href");this.nodes.input.value=n!=="null"?n:"",this.selection.save()}else this.nodes.button.innerHTML=ok,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){let n=new _e;n.save(),this.selection.restore(),this.selection.removeFakeBackground(),n.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let n=this.nodes.input.value||"";if(!n.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(n)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),We("Incorrect Link pasted","warn",n);return}n=this.prepareLink(n),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(n),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;let n=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",r=/^\/\/[^/\s]/.test(e);return!n&&!o&&!r&&(e="http://"+e),e}insertLink(e){let n=this.selection.findParentTag("A");n&&this.selection.expandToTag(n),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}};Ec.isInline=!0;Ec.title="Link";var ip=class{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){let e=_e.get(),n=this.blocksAPI.getBlockByElement(e.anchorNode);if(n===void 0)return[];let o=this.toolsAPI.getBlockTools(),r=await Ck(n,o);if(r.length===0)return[];let i=r.reduce((c,d)=>{var u;return(u=d.toolbox)==null||u.forEach(p=>{c.push({icon:p.icon,title:wn.t(oo.toolNames,p.title),name:d.name,closeOnActivate:!0,onActivate:async()=>{let h=await this.blocksAPI.convert(n.id,d.name,p.data);this.caretAPI.setToBlock(h,"end")}})}),c},[]),s=await n.getActiveToolboxEntry(),a=s!==void 0?s.icon:Nk,l=!ka();return{icon:a,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}};ip.isInline=!0;var sp=class{constructor({data:e,api:n}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=n,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){let e=U.make("div",this.CSS.wrapper),n=z5,o=U.make("div",this.CSS.info),r=U.make("div",this.CSS.title,{textContent:this.title}),i=U.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=n,o.appendChild(r),o.appendChild(i),e.appendChild(o),e}};sp.isReadOnlySupported=!0;var k_=class extends xc{constructor(){super(...arguments),this.type=ds.Inline}get title(){return this.constructable[rp.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[rp.IsReadOnlySupported]??!1}},N_=class extends xc{constructor(){super(...arguments),this.type=ds.Tune}create(e,n){return new this.constructable({api:this.api,config:this.settings,block:n,data:e})}},yo=class t extends Map{get blockTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isBlock());return new t(e)}get inlineTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInline());return new t(e)}get blockTunes(){let e=Array.from(this.entries()).filter(([,n])=>n.isTune());return new t(e)}get internalTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInternal);return new t(e)}get externalTools(){let e=Array.from(this.entries()).filter(([,n])=>!n.isInternal);return new t(e)}},P6=Object.defineProperty,F6=Object.getOwnPropertyDescriptor,uN=(t,e,n,o)=>{for(var r=o>1?void 0:o?F6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&P6(e,n,r),r},wc=class extends xc{constructor(){super(...arguments),this.type=ds.Block,this.inlineTools=new yo,this.tunes=new yo}create(e,n,o){return new this.constructable({data:e,block:n,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Ca.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[Ca.IsEnabledLineBreaks]}get toolbox(){let e=this.constructable[Ca.Toolbox],n=this.config[ju.Toolbox];if(!vo(e)&&n!==!1)return n?Array.isArray(e)?Array.isArray(n)?n.map((o,r)=>{let i=e[r];return i?{...i,...o}:o}):[n]:Array.isArray(n)?n:[{...e,...n}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[Ca.ConversionConfig]}get enabledInlineTools(){return this.config[ju.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[ju.EnabledBlockTunes]}get pasteConfig(){return this.constructable[Ca.PasteConfig]??{}}get sanitizeConfig(){let e=super.sanitizeConfig,n=this.baseSanitizeConfig;if(vo(e))return n;let o={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r];an(i)?o[r]=Object.assign({},n,i):o[r]=i}return o}get baseSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),Array.from(this.tunes.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),e}};uN([Sa],wc.prototype,"sanitizeConfig",1);uN([Sa],wc.prototype,"baseSanitizeConfig",1);var D_=class{constructor(e,n,o){this.api=o,this.config=e,this.editorConfig=n}get(e){let{class:n,isInternal:o=!1,...r}=this.config[e],i=this.getConstructor(n),s=n[u_.IsTune];return new i({name:e,constructable:n,config:r,api:this.api.getMethodsForTool(e,s),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[rp.IsInline]:return k_;case e[u_.IsTune]:return N_;default:return wc}}},ap=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:D5,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e+1);if(!n)throw new Error("Unable to move Block down since it is already the last");let o=n.holder,r=o.getBoundingClientRect(),i=Math.abs(window.innerHeight-o.offsetHeight);r.top<window.innerHeight&&(i=window.scrollY+o.offsetHeight),window.scrollTo(0,i),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}};ap.isTune=!0;var lp=class{constructor({api:e}){this.api=e}render(){return{icon:M5,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}};lp.isTune=!0;var cp=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:A5,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!n||!o)throw new Error("Unable to move Block up since it is already the first");let r=n.holder,i=o.holder,s=r.getBoundingClientRect(),a=i.getBoundingClientRect(),l;a.top>0?l=Math.abs(s.top)-Math.abs(a.top):l=Math.abs(s.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}};cp.isTune=!0;var B6=Object.defineProperty,$6=Object.getOwnPropertyDescriptor,z6=(t,e,n,o)=>{for(var r=o>1?void 0:o?$6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&B6(e,n,r),r},dp=class extends Le{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new yo,this.toolsUnavailable=new yo}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=Lm({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");let e=this.prepareConfig();this.factory=new D_(e,this.config,this.Editor.API);let n=this.getListOfPrepareFunctions(e);if(n.length===0)return Promise.resolve();await X4(n,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>{Object.assign(e,n.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{ht(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:ip,isInternal:!0},link:{class:Ec,isInternal:!0},bold:{class:vc,isInternal:!0},italic:{class:Cc,isInternal:!0},paragraph:{class:S_,inlineToolbar:!0,isInternal:!0},stub:{class:sp,isInternal:!0},moveUp:{class:cp,isInternal:!0},delete:{class:lp,isInternal:!0},moveDown:{class:ap,isInternal:!0}}}toolPrepareMethodSuccess(e){let n=this.factory.get(e.toolName);if(n.isInline()){let o=["render"].filter(r=>!n.create()[r]);if(o.length){We(`Incorrect Inline Tool: ${n.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(n.name,n);return}}this.toolsAvailable.set(n.name,n)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){let n=[];return Object.entries(e).forEach(([o,r])=>{n.push({function:ht(r.class.prepare)?r.class.prepare:()=>{},data:{toolName:o,config:r.config}})}),n}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new yo(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(n=>[n,this.inlineTools.get(n)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new yo(["convertTo",...e.enabledInlineTools].map(n=>[n,this.inlineTools.get(n)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){let n=new yo(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new yo([...n,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){let n=new yo(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new yo([...n,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(let e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;let n=this.config.tools[e];if(!ht(n)&&!ht(n.class))throw Error(`Tool \xAB${e}\xBB must be a constructor function or an object with function in the \xABclass\xBB property`)}}prepareConfig(){let e={};for(let n in this.config.tools)an(this.config.tools[n])?e[n]=this.config.tools[n]:e[n]={class:this.config.tools[n]};return e}};z6([Sa],dp.prototype,"getAllInlineToolsSanitizeConfig",1);var H6=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
103
+ `,O_=class extends Le{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=ek(()=>{this.windowResize()},200),this.selectionChangeDebounced=ek(()=>{this.selectionChanged()},I6),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;let e=this.nodes.wrapper.querySelector(`.${Do.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){let{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;return!!(n.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,n])=>n.flipper instanceof wa).some(([e,n])=>n.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;n.close(),o.close(),e.toolbox.close()}setIsMobile(){let e=window.innerWidth<hk;e!==this.isMobile&&this.eventsDispatcher.emit(bc,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=U.getHolder(this.config.holder),this.nodes.wrapper=U.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=U.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){let e="editor-js-styles";if(U.get(e))return;let n=U.make("style",null,{id:e,textContent:H6.toString()});this.config.style&&!vo(this.config.style)&&this.config.style.nonce&&n.setAttribute("nonce",this.config.style.nonce),U.prepend(document.head,n)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",Mm(n=>{let o=n.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(Rk,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case we.ENTER:this.enterPressed(e);break;case we.BACKSPACE:case we.DELETE:this.backspacePressed(e);break;case we.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){let{currentBlock:n}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(n!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||n&&r||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor;if(o.anyBlockSelected&&!_e.isSelectionExists){let i=n.removeSelectedBlocks(),s=n.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){let{BlockManager:n,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;let r=n.currentBlockIndex>=0;if(o.anyBlockSelected&&!_e.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&r&&e.target.tagName==="BODY"){let i=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var n,o;if(!e.isTrusted)return;let r=e.target;this.nodes.holder.contains(r)||_e.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());let i=(n=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:n.contains(r),s=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(r),a=i||s;if(this.Editor.BlockSettings.opened&&!a){this.Editor.BlockSettings.close();let l=this.Editor.BlockManager.getBlockByChildNode(r);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let n=e.target;if(n===this.nodes.redactor){let o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,r=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;n=document.elementFromPoint(o,r)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(n)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!_e.isCollapsed)return;let n=e.target,o=e.metaKey||e.ctrlKey;if(U.isAnchor(n)&&o){e.stopImmediatePropagation(),e.stopPropagation();let r=n.getAttribute("href"),i=t5(r);o5(i);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){let n=this.Editor.BlockManager.getBlockByIndex(-1),o=U.offset(n.holder).bottom,r=e.pageY,{BlockSelection:i}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<r){e.stopImmediatePropagation(),e.stopPropagation();let{BlockManager:s,Caret:a,Toolbar:l}=this.Editor;(!s.lastBlock.tool.isDefault||!s.lastBlock.isEmpty)&&s.insertAtEnd(),a.setToTheLastBlock(),l.moveAndOpen(s.lastBlock)}}selectionChanged(){let{CrossBlockSelection:e,BlockSelection:n}=this.Editor,o=_e.anchorElement;if(e.isCrossBlockSelectionStarted&&n.anyBlockSelected&&_e.get().removeAllRanges(),!o){_e.range||this.Editor.InlineToolbar.close();return}let r=o.closest(`.${Do.CSS.content}`);(r===null||r.closest(`.${_e.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(n){let o=n.target;gk(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}},U6={BlocksAPI:$m,CaretAPI:zm,EventsAPI:Hm,I18nAPI:Um,API:Km,InlineToolbarAPI:jm,ListenersAPI:Vm,NotifierAPI:Gm,ReadOnlyAPI:Ym,SanitizerAPI:qm,SaverAPI:Jm,SelectionAPI:Xm,ToolsAPI:Zm,StylesAPI:Qm,ToolbarAPI:e_,TooltipAPI:t_,UiAPI:n_,BlockSettings:l_,Toolbar:d_,InlineToolbar:p_,BlockEvents:h_,BlockManager:m_,BlockSelection:__,Caret:b_,CrossBlockSelection:y_,DragNDrop:x_,ModificationsObserver:v_,Paste:M6,ReadOnly:C_,RectangleSelection:E_,Renderer:w_,Saver:T_,Tools:dp,UI:O_},I_=class{constructor(e){this.moduleInstances={},this.eventsDispatcher=new ps;let n,o;this.isReady=new Promise((r,i)=>{n=r,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();let{BlockManager:r,Caret:i,UI:s,ModificationsObserver:a}=this.moduleInstances;s.checkEmptiness(),a.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(r.blocks[0],i.positions.START),n()}).catch(r=>{We(`Editor.js is not ready because of ${r}`,"error"),o(r)})}set configuration(e){var n,o;an(e)?this.config={...e}:this.config={holder:e},Rm(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=uk.VERBOSE),q4(this.config.logLevel),Rm(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;let r={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(vo(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[r]}),this.config.readOnly=this.config.readOnly||!1,(n=this.config.i18n)!=null&&n.messages&&wn.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){let{holderId:e,holder:n}=this.config;if(e&&n)throw Error("\xABholderId\xBB and \xABholder\xBB param can't assign at the same time.");if(Dr(n)&&!U.get(n))throw Error(`element with ID \xAB${n}\xBB is missing. Pass correct holder's ID.`);if(n&&an(n)&&!U.isElement(n))throw Error("\xABholder\xBB value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,n)=>e.then(async()=>{try{await this.moduleInstances[n].prepare()}catch(o){if(o instanceof Ju)throw new Error(o.message);We(`Module ${n} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(U6).forEach(([e,n])=>{try{this.moduleInstances[e]=new n({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){We("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(let e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){let n={};for(let o in this.moduleInstances)o!==e&&(n[o]=this.moduleInstances[o]);return n}};var up=class{static get version(){return"2.31.0-rc.7"}constructor(e){let n=()=>{};an(e)&&ht(e.onReady)&&(n=e.onReady);let o=new I_(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),n()})}exportAPI(e){let n=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(r=>{ht(r.destroy)&&r.destroy(),r.listeners.removeAll()}),S5(),e=null;for(let r in this)Object.prototype.hasOwnProperty.call(this,r)&&delete this[r];Object.setPrototypeOf(this,null)};n.forEach(r=>{this[r]=e[r]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([r,i])=>{Object.entries(i).forEach(([s,a])=>{this[a]=e.moduleInstances.API.methods[r][s]})})}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var K6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',j6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',V6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',W6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',G6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',Y6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',q6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';var vp=class{constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._settings=n,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){let n={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(n.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(n.level=parseInt(e.level.toString()))),n}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){let n=this.getTag();n.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(n,this._element),this._element=n}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){let e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(n=>n.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){let e=this.levels.find(n=>n.number===this._settings.defaultLevel);if(e)return e;console.warn("(\u0E07'\u0300-'\u0301)\u0E07 Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){let e=[{number:1,tag:"H1",svg:K6},{number:2,tag:"H2",svg:j6},{number:3,tag:"H3",svg:V6},{number:4,tag:"H4",svg:W6},{number:5,tag:"H5",svg:G6},{number:6,tag:"H6",svg:Y6}];return this._settings.levels?e.filter(n=>this._settings.levels.includes(n.number)):e}onPaste(e){let n=e.detail;if("data"in n){let o=n.data,r=this.defaultLevel.number;switch(o.tagName){case"H1":r=1;break;case"H2":r=2;break;case"H3":r=3;break;case"H4":r=4;break;case"H5":r=5;break;case"H6":r=6;break}this._settings.levels&&(r=this._settings.levels.reduce((i,s)=>Math.abs(s-r)<Math.abs(i-r)?s:i)),this.data={level:r,text:o.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:q6,title:"Heading"}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:block}.image-tool__image-preloader{width:50px;height:50px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;animation:image-preloader-spin 2s infinite linear;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important;content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:flex;align-items:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading .image-tool__image{min-height:200px;display:flex;border:1px solid var(--border-color);background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@keyframes image-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var J6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',X6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',pN='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.13968 15.32L8.69058 11.5661C9.02934 11.2036 9.48873 11 9.96774 11C10.4467 11 10.9061 11.2036 11.2449 11.5661L15.3871 16M13.5806 14.0664L15.0132 12.533C15.3519 12.1705 15.8113 11.9668 16.2903 11.9668C16.7693 11.9668 17.2287 12.1705 17.5675 12.533L18.841 13.9634"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.7778 9.33331H13.7867"/></svg>',Z6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',Q6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function Na(t,e=null,n={}){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e!==null&&o.classList.add(e);for(let r in n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o}var Cp=(t=>(t.Empty="empty",t.Uploading="uploading",t.Filled="filled",t))(Cp||{}),Tb=class{constructor({api:e,config:n,onSelectFile:o,readOnly:r}){this.api=e,this.config=n,this.onSelectFile=o,this.readOnly=r,this.nodes={wrapper:Na("div",[this.CSS.baseClass,this.CSS.wrapper]),imageContainer:Na("div",[this.CSS.imageContainer]),fileButton:this.createFileButton(),imageEl:void 0,imagePreloader:Na("div",this.CSS.imagePreloader),caption:Na("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly})},this.nodes.caption.dataset.placeholder=this.config.captionPlaceholder,this.nodes.imageContainer.appendChild(this.nodes.imagePreloader),this.nodes.wrapper.appendChild(this.nodes.imageContainer),this.nodes.wrapper.appendChild(this.nodes.caption),this.nodes.wrapper.appendChild(this.nodes.fileButton)}applyTune(e,n){this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${e}`,n)}render(){return this.toggleStatus("empty"),this.nodes.wrapper}showPreloader(e){this.nodes.imagePreloader.style.backgroundImage=`url(${e})`,this.toggleStatus("uploading")}hidePreloader(){this.nodes.imagePreloader.style.backgroundImage="",this.toggleStatus("empty")}fillImage(e){let n=/\.mp4$/.test(e)?"VIDEO":"IMG",o={src:e},r="load";n==="VIDEO"&&(o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsinline=!0,r="loadeddata"),this.nodes.imageEl=Na(n,this.CSS.imageEl,o),this.nodes.imageEl.addEventListener(r,()=>{this.toggleStatus("filled"),this.nodes.imagePreloader!==void 0&&(this.nodes.imagePreloader.style.backgroundImage="")}),this.nodes.imageContainer.appendChild(this.nodes.imageEl)}fillCaption(e){this.nodes.caption!==void 0&&(this.nodes.caption.innerHTML=e)}toggleStatus(e){for(let n in Cp)if(Object.prototype.hasOwnProperty.call(Cp,n)){let o=Cp[n];this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${o}`,o===e)}}get CSS(){return{baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,button:this.api.styles.button,wrapper:"image-tool",imageContainer:"image-tool__image",imagePreloader:"image-tool__image-preloader",imageEl:"image-tool__image-picture",caption:"image-tool__caption"}}createFileButton(){let e=Na("div",[this.CSS.button]);return e.innerHTML=this.config.buttonContent??`${pN} ${this.api.i18n.t("Select an Image")}`,e.addEventListener("click",()=>{this.onSelectFile()}),e}};function eK(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fN={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=3)})([function(n,o){var r;r=(function(){return this})();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}n.exports=r},function(n,o,r){(function(i){var s=r(2),a=setTimeout;function l(){}function c(_){if(!(this instanceof c))throw new TypeError("Promises must be constructed via new");if(typeof _!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],m(_,this)}function d(_,b){for(;_._state===3;)_=_._value;_._state!==0?(_._handled=!0,c._immediateFn(function(){var y=_._state===1?b.onFulfilled:b.onRejected;if(y!==null){var v;try{v=y(_._value)}catch(x){return void p(b.promise,x)}u(b.promise,v)}else(_._state===1?u:p)(b.promise,_._value)})):_._deferreds.push(b)}function u(_,b){try{if(b===_)throw new TypeError("A promise cannot be resolved with itself.");if(b&&(typeof b=="object"||typeof b=="function")){var y=b.then;if(b instanceof c)return _._state=3,_._value=b,void h(_);if(typeof y=="function")return void m((v=y,x=b,function(){v.apply(x,arguments)}),_)}_._state=1,_._value=b,h(_)}catch(C){p(_,C)}var v,x}function p(_,b){_._state=2,_._value=b,h(_)}function h(_){_._state===2&&_._deferreds.length===0&&c._immediateFn(function(){_._handled||c._unhandledRejectionFn(_._value)});for(var b=0,y=_._deferreds.length;b<y;b++)d(_,_._deferreds[b]);_._deferreds=null}function g(_,b,y){this.onFulfilled=typeof _=="function"?_:null,this.onRejected=typeof b=="function"?b:null,this.promise=y}function m(_,b){var y=!1;try{_(function(v){y||(y=!0,u(b,v))},function(v){y||(y=!0,p(b,v))})}catch(v){if(y)return;y=!0,p(b,v)}}c.prototype.catch=function(_){return this.then(null,_)},c.prototype.then=function(_,b){var y=new this.constructor(l);return d(this,new g(_,b,y)),y},c.prototype.finally=s.a,c.all=function(_){return new c(function(b,y){if(!_||_.length===void 0)throw new TypeError("Promise.all accepts an array");var v=Array.prototype.slice.call(_);if(v.length===0)return b([]);var x=v.length;function C(k,T){try{if(T&&(typeof T=="object"||typeof T=="function")){var w=T.then;if(typeof w=="function")return void w.call(T,function(S){C(k,S)},y)}v[k]=T,--x==0&&b(v)}catch(S){y(S)}}for(var E=0;E<v.length;E++)C(E,v[E])})},c.resolve=function(_){return _&&typeof _=="object"&&_.constructor===c?_:new c(function(b){b(_)})},c.reject=function(_){return new c(function(b,y){y(_)})},c.race=function(_){return new c(function(b,y){for(var v=0,x=_.length;v<x;v++)_[v].then(b,y)})},c._immediateFn=typeof i=="function"&&function(_){i(_)}||function(_){a(_,0)},c._unhandledRejectionFn=function(_){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",_)},o.a=c}).call(this,r(5).setImmediate)},function(n,o,r){o.a=function(i){var s=this.constructor;return this.then(function(a){return s.resolve(i()).then(function(){return a})},function(a){return s.resolve(i()).then(function(){return s.reject(a)})})}},function(n,o,r){function i(m){return(i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _})(m)}r(4);var s,a,l,c,d,u,p,h=r(8),g=(a=function(m){return new Promise(function(_,b){m=c(m),(m=d(m)).beforeSend&&m.beforeSend();var y=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");y.open(m.method,m.url),y.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(m.headers).forEach(function(x){var C=m.headers[x];y.setRequestHeader(x,C)});var v=m.ratio;y.upload.addEventListener("progress",function(x){var C=Math.round(x.loaded/x.total*100),E=Math.ceil(C*v/100);m.progress(Math.min(E,100))},!1),y.addEventListener("progress",function(x){var C=Math.round(x.loaded/x.total*100),E=Math.ceil(C*(100-v)/100)+v;m.progress(Math.min(E,100))},!1),y.onreadystatechange=function(){if(y.readyState===4){var x=y.response;try{x=JSON.parse(x)}catch{}var C=h.parseHeaders(y.getAllResponseHeaders()),E={body:x,code:y.status,headers:C};p(y.status)?_(E):b(E)}},y.send(m.data)})},l=function(m){return m.method="POST",a(m)},c=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(m.url&&typeof m.url!="string")throw new Error("Url must be a string");if(m.url=m.url||"",m.method&&typeof m.method!="string")throw new Error("`method` must be a string or null");if(m.method=m.method?m.method.toUpperCase():"GET",m.headers&&i(m.headers)!=="object")throw new Error("`headers` must be an object or null");if(m.headers=m.headers||{},m.type&&(typeof m.type!="string"||!Object.values(s).includes(m.type)))throw new Error("`type` must be taken from module's \xABcontentType\xBB library");if(m.progress&&typeof m.progress!="function")throw new Error("`progress` must be a function or null");if(m.progress=m.progress||function(_){},m.beforeSend=m.beforeSend||function(_){},m.ratio&&typeof m.ratio!="number")throw new Error("`ratio` must be a number");if(m.ratio<0||m.ratio>100)throw new Error("`ratio` must be in a 0-100 interval");if(m.ratio=m.ratio||90,m.accept&&typeof m.accept!="string")throw new Error("`accept` must be a string with a list of allowed mime-types");if(m.accept=m.accept||"*/*",m.multiple&&typeof m.multiple!="boolean")throw new Error("`multiple` must be a true or false");if(m.multiple=m.multiple||!1,m.fieldName&&typeof m.fieldName!="string")throw new Error("`fieldName` must be a string");return m.fieldName=m.fieldName||"files",m},d=function(m){switch(m.method){case"GET":var _=u(m.data,s.URLENCODED);delete m.data,m.url=/\?/.test(m.url)?m.url+"&"+_:m.url+"?"+_;break;case"POST":case"PUT":case"DELETE":case"UPDATE":var b=(function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).type||s.JSON})(m);(h.isFormData(m.data)||h.isFormElement(m.data))&&(b=s.FORM),m.data=u(m.data,b),b!==g.contentType.FORM&&(m.headers["content-type"]=b)}return m},u=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};switch(arguments.length>1?arguments[1]:void 0){case s.URLENCODED:return h.urlEncode(m);case s.JSON:return h.jsonEncode(m);case s.FORM:return h.formEncode(m);default:return m}},p=function(m){return m>=200&&m<300},{contentType:s={URLENCODED:"application/x-www-form-urlencoded; charset=utf-8",FORM:"multipart/form-data",JSON:"application/json; charset=utf-8"},request:a,get:function(m){return m.method="GET",a(m)},post:l,transport:function(m){return m=c(m),h.selectFiles(m).then(function(_){for(var b=new FormData,y=0;y<_.length;y++)b.append(m.fieldName,_[y],_[y].name);h.isObject(m.data)&&Object.keys(m.data).forEach(function(x){var C=m.data[x];b.append(x,C)});var v=m.beforeSend;return m.beforeSend=function(){return v(_)},m.data=b,l(m)})},selectFiles:function(m){return delete(m=c(m)).beforeSend,h.selectFiles(m)}});n.exports=g},function(n,o,r){r.r(o);var i=r(1);window.Promise=window.Promise||i.a},function(n,o,r){(function(i){var s=i!==void 0&&i||typeof self<"u"&&self||window,a=Function.prototype.apply;function l(c,d){this._id=c,this._clearFn=d}o.setTimeout=function(){return new l(a.call(setTimeout,s,arguments),clearTimeout)},o.setInterval=function(){return new l(a.call(setInterval,s,arguments),clearInterval)},o.clearTimeout=o.clearInterval=function(c){c&&c.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(s,this._id)},o.enroll=function(c,d){clearTimeout(c._idleTimeoutId),c._idleTimeout=d},o.unenroll=function(c){clearTimeout(c._idleTimeoutId),c._idleTimeout=-1},o._unrefActive=o.active=function(c){clearTimeout(c._idleTimeoutId);var d=c._idleTimeout;d>=0&&(c._idleTimeoutId=setTimeout(function(){c._onTimeout&&c._onTimeout()},d))},r(6),o.setImmediate=typeof self<"u"&&self.setImmediate||i!==void 0&&i.setImmediate||this&&this.setImmediate,o.clearImmediate=typeof self<"u"&&self.clearImmediate||i!==void 0&&i.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(n,o,r){(function(i,s){(function(a,l){if(!a.setImmediate){var c,d,u,p,h,g=1,m={},_=!1,b=a.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(a);y=y&&y.setTimeout?y:a,{}.toString.call(a.process)==="[object process]"?c=function(C){s.nextTick(function(){x(C)})}:(function(){if(a.postMessage&&!a.importScripts){var C=!0,E=a.onmessage;return a.onmessage=function(){C=!1},a.postMessage("","*"),a.onmessage=E,C}})()?(p="setImmediate$"+Math.random()+"$",h=function(C){C.source===a&&typeof C.data=="string"&&C.data.indexOf(p)===0&&x(+C.data.slice(p.length))},a.addEventListener?a.addEventListener("message",h,!1):a.attachEvent("onmessage",h),c=function(C){a.postMessage(p+C,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(C){x(C.data)},c=function(C){u.port2.postMessage(C)}):b&&"onreadystatechange"in b.createElement("script")?(d=b.documentElement,c=function(C){var E=b.createElement("script");E.onreadystatechange=function(){x(C),E.onreadystatechange=null,d.removeChild(E),E=null},d.appendChild(E)}):c=function(C){setTimeout(x,0,C)},y.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var E=new Array(arguments.length-1),k=0;k<E.length;k++)E[k]=arguments[k+1];var T={callback:C,args:E};return m[g]=T,c(g),g++},y.clearImmediate=v}function v(C){delete m[C]}function x(C){if(_)setTimeout(x,0,C);else{var E=m[C];if(E){_=!0;try{(function(k){var T=k.callback,w=k.args;switch(w.length){case 0:T();break;case 1:T(w[0]);break;case 2:T(w[0],w[1]);break;case 3:T(w[0],w[1],w[2]);break;default:T.apply(l,w)}})(E)}finally{v(C),_=!1}}}}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,r(0),r(7))},function(n,o){var r,i,s=n.exports={};function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(y){if(r===setTimeout)return setTimeout(y,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(y,0);try{return r(y,0)}catch{try{return r.call(null,y,0)}catch{return r.call(this,y,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:a}catch{r=a}try{i=typeof clearTimeout=="function"?clearTimeout:l}catch{i=l}})();var d,u=[],p=!1,h=-1;function g(){p&&d&&(p=!1,d.length?u=d.concat(u):h=-1,u.length&&m())}function m(){if(!p){var y=c(g);p=!0;for(var v=u.length;v;){for(d=u,u=[];++h<v;)d&&d[h].run();h=-1,v=u.length}d=null,p=!1,(function(x){if(i===clearTimeout)return clearTimeout(x);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(x);try{i(x)}catch{try{return i.call(null,x)}catch{return i.call(this,x)}}})(y)}}function _(y,v){this.fun=y,this.array=v}function b(){}s.nextTick=function(y){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];u.push(new _(y,v)),u.length!==1||p||c(m)},_.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=b,s.addListener=b,s.once=b,s.off=b,s.removeListener=b,s.removeAllListeners=b,s.emit=b,s.prependListener=b,s.prependOnceListener=b,s.listeners=function(y){return[]},s.binding=function(y){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(y){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(n,o,r){function i(a,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=r(9);n.exports=(function(){function a(){(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,a)}var l,c,d;return l=a,d=[{key:"urlEncode",value:function(u){return s(u)}},{key:"jsonEncode",value:function(u){return JSON.stringify(u)}},{key:"formEncode",value:function(u){if(this.isFormData(u))return u;if(this.isFormElement(u))return new FormData(u);if(this.isObject(u)){var p=new FormData;return Object.keys(u).forEach(function(h){var g=u[h];p.append(h,g)}),p}throw new Error("`data` must be an instance of Object, FormData or <FORM> HTMLElement")}},{key:"isObject",value:function(u){return Object.prototype.toString.call(u)==="[object Object]"}},{key:"isFormData",value:function(u){return u instanceof FormData}},{key:"isFormElement",value:function(u){return u instanceof HTMLFormElement}},{key:"selectFiles",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p,h){var g=document.createElement("INPUT");g.type="file",u.multiple&&g.setAttribute("multiple","multiple"),u.accept&&g.setAttribute("accept",u.accept),g.style.display="none",document.body.appendChild(g),g.addEventListener("change",function(m){var _=m.target.files;p(_),document.body.removeChild(g)},!1),g.click()})}},{key:"parseHeaders",value:function(u){var p=u.trim().split(/[\r\n]+/),h={};return p.forEach(function(g){var m=g.split(": "),_=m.shift(),b=m.join(": ");_&&(h[_]=b)}),h}}],(c=null)&&i(l.prototype,c),d&&i(l,d),a})()},function(n,o){var r=function(s){return encodeURIComponent(s).replace(/[!'()*]/g,escape).replace(/%20/g,"+")},i=function(s,a,l,c){return a=a||null,l=l||"&",c=c||null,s?(function(d){for(var u=new Array,p=0;p<d.length;p++)d[p]&&u.push(d[p]);return u})(Object.keys(s).map(function(d){var u,p,h=d;if(c&&(h=c+"["+h+"]"),typeof s[d]=="object"&&s[d]!==null)u=i(s[d],null,l,h);else{a&&(p=h,h=!isNaN(parseFloat(p))&&isFinite(p)?a+Number(h):h);var g=s[d];g=(g=(g=(g=g===!0?"1":g)===!1?"0":g)===0?"0":g)||"",u=r(h)+"="+r(g)}return u})).join(l).replace(/[!'()*]/g,""):""};n.exports=i}])})})(fN);var tK=fN.exports,Da=eK(tK);function wb(t){return t!==void 0&&typeof t.then=="function"}var Sb=class{constructor({config:e,onUpload:n,onError:o}){this.config=e,this.onUpload=n,this.onError=o}uploadSelectedFile({onPreview:e}){let n=function(r){let i=new FileReader;i.readAsDataURL(r),i.onload=s=>{e(s.target.result)}},o;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function"){let r=this.config.uploader.uploadByFile;o=Da.selectFiles({accept:this.config.types??"image/*"}).then(i=>{n(i[0]);let s=r(i[0]);return wb(s)||console.warn("Custom uploader method uploadByFile should return a Promise"),s})}else o=Da.transport({url:this.config.endpoints.byFile,data:this.config.additionalRequestData,accept:this.config.types??"image/*",headers:this.config.additionalRequestHeaders,beforeSend:r=>{n(r[0])},fieldName:this.config.field??"image"}).then(r=>r.body);o.then(r=>{this.onUpload(r)}).catch(r=>{this.onError(r)})}uploadByUrl(e){let n;this.config.uploader&&typeof this.config.uploader.uploadByUrl=="function"?(n=this.config.uploader.uploadByUrl(e),wb(n)||console.warn("Custom uploader method uploadByUrl should return a Promise")):n=Da.post({url:this.config.endpoints.byUrl,data:Object.assign({url:e},this.config.additionalRequestData),type:Da.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(o=>o.body),n.then(o=>{this.onUpload(o)}).catch(o=>{this.onError(o)})}uploadByFile(e,{onPreview:n}){let o=new FileReader;o.readAsDataURL(e),o.onload=i=>{n(i.target.result)};let r;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function")r=this.config.uploader.uploadByFile(e),wb(r)||console.warn("Custom uploader method uploadByFile should return a Promise");else{let i=new FormData;i.append(this.config.field??"image",e),this.config.additionalRequestData&&Object.keys(this.config.additionalRequestData).length&&Object.entries(this.config.additionalRequestData).forEach(([s,a])=>{i.append(s,a)}),r=Da.post({url:this.config.endpoints.byFile,data:i,type:Da.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(s=>s.body)}r.then(i=>{this.onUpload(i)}).catch(i=>{this.onError(i)})}};var Ep=class t{constructor({data:e,config:n,api:o,readOnly:r,block:i}){this.isCaptionEnabled=null,this.api=o,this.block=i,this.config={endpoints:n.endpoints,additionalRequestData:n.additionalRequestData,additionalRequestHeaders:n.additionalRequestHeaders,field:n.field,types:n.types,captionPlaceholder:this.api.i18n.t(n.captionPlaceholder??"Caption"),buttonContent:n.buttonContent,uploader:n.uploader,actions:n.actions,features:n.features||{}},this.uploader=new Sb({config:this.config,onUpload:s=>this.onUpload(s),onError:s=>this.uploadingFailed(s)}),this.ui=new Tb({api:o,config:this.config,onSelectFile:()=>{this.uploader.uploadSelectedFile({onPreview:s=>{this.ui.showPreloader(s)}})},readOnly:r}),this._data={caption:"",withBorder:!1,withBackground:!1,stretched:!1,file:{url:""}},this.data=e}static get isReadOnlySupported(){return!0}static get toolbox(){return{icon:pN,title:"Image"}}static get tunes(){return[{name:"withBorder",icon:X6,title:"With border",toggle:!0},{name:"stretched",icon:Z6,title:"Stretch image",toggle:!0},{name:"withBackground",icon:J6,title:"With background",toggle:!0}]}render(){var e,n,o;return(((e=this.config.features)==null?void 0:e.caption)===!0||((n=this.config.features)==null?void 0:n.caption)===void 0||((o=this.config.features)==null?void 0:o.caption)==="optional"&&this.data.caption)&&(this.isCaptionEnabled=!0),this.ui.render()}validate(e){return!!e.file.url}save(){let e=this.ui.nodes.caption;return this._data.caption=e.innerHTML,this.data}renderSettings(){var e;let n=t.tunes.concat(this.config.actions||[]),o={border:"withBorder",background:"withBackground",stretch:"stretched",caption:"caption"};((e=this.config.features)==null?void 0:e.caption)==="optional"&&n.push({name:"caption",icon:Q6,title:"With caption",toggle:!0});let r=n.filter(s=>{var a,l;let c=Object.keys(o).find(d=>o[d]===s.name);return c==="caption"?((a=this.config.features)==null?void 0:a.caption)!==!1:c==null||((l=this.config.features)==null?void 0:l[c])!==!1}),i=s=>{let a=this.data[s.name];return s.name==="caption"&&(a=this.isCaptionEnabled??a),a};return r.map(s=>({icon:s.icon,label:this.api.i18n.t(s.title),name:s.name,toggle:s.toggle,isActive:i(s),onActivate:()=>{if(typeof s.action=="function"){s.action(s.name);return}let a=!i(s);s.name==="caption"&&(this.isCaptionEnabled=!(this.isCaptionEnabled??!1),a=this.isCaptionEnabled),this.tuneToggled(s.name,a)}}))}appendCallback(){this.ui.nodes.fileButton.click()}static get pasteConfig(){return{tags:[{img:{src:!0}}],patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|svg|webp)(\?[a-z0-9=]*)?$/i},files:{mimeTypes:["image/*"]}}}async onPaste(e){switch(e.type){case"tag":{let n=e.detail.data;if(/^blob:/.test(n.src)){let o=await(await fetch(n.src)).blob();this.uploadFile(o);break}this.uploadUrl(n.src);break}case"pattern":{let n=e.detail.data;this.uploadUrl(n);break}case"file":{let n=e.detail.file;this.uploadFile(n);break}}}set data(e){this.image=e.file,this._data.caption=e.caption||"",this.ui.fillCaption(this._data.caption),t.tunes.forEach(({name:n})=>{let o=typeof e[n]<"u"?e[n]===!0||e[n]==="true":!1;this.setTune(n,o)}),e.caption&&this.setTune("caption",!0)}get data(){return this._data}set image(e){this._data.file=e||{url:""},e&&e.url&&this.ui.fillImage(e.url)}onUpload(e){e.success&&e.file?this.image=e.file:this.uploadingFailed("incorrect response: "+JSON.stringify(e))}uploadingFailed(e){console.log("Image Tool: uploading failed because of",e),this.api.notifier.show({message:this.api.i18n.t("Couldn\u2019t upload image. Please try another."),style:"error"}),this.ui.hidePreloader()}tuneToggled(e,n){e==="caption"?(this.ui.applyTune(e,n),n==!1&&(this._data.caption="",this.ui.fillCaption(""))):this.setTune(e,n)}setTune(e,n){this._data[e]=n,this.ui.applyTune(e,n),e==="stretched"&&Promise.resolve().then(()=>{this.block.stretched=n}).catch(o=>{console.error(o)})}uploadFile(e){this.uploader.uploadByFile(e,{onPreview:n=>{this.ui.showPreloader(n)}})}uploadUrl(e){this.ui.showPreloader(e),this.uploader.uploadByUrl(e)}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"\u2022"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function Or(t){return t.nodeType===Node.ELEMENT_NODE}function Oa(t,e=null,n){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(let r in n)o[r]=n[r];return o}function hN(t){let e=Oa("div");return e.appendChild(t),e.innerHTML}function mN(t){let e;return t.nodeType!==Node.ELEMENT_NODE?e=t.textContent:(e=t.innerHTML,e=e.replaceAll("<br>","")),e?.trim().length===0}var gi=class t{constructor(){this.savedFakeCaret=void 0}save(){let e=t.range,n=Oa("span");n.hidden=!0,e&&(e.insertNode(n),this.savedFakeCaret=n)}restore(){if(!this.savedFakeCaret)return;let e=window.getSelection();if(!e)return;let n=new Range;n.setStartAfter(this.savedFakeCaret),n.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(n),setTimeout(()=>{var o;(o=this.savedFakeCaret)==null||o.remove()},150)}static get range(){let e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){let e=window.getSelection();if(!e||!e.rangeCount)return;let n=e.getRangeAt(0),o=n.startContainer;if(o.nodeType!==Node.ELEMENT_NODE){if(!o.parentNode)return;o=o.parentNode}if(!Or(o))return;let r=o.closest("[contenteditable]");if(!r)return;n.deleteContents();let i=n.cloneRange();return i.selectNodeContents(r),i.setStart(n.endContainer,n.endOffset),i.extractContents()}static focus(e,n=!0){let o=document.createRange(),r=window.getSelection();r&&(o.selectNodeContents(e),o.collapse(n),r.removeAllRanges(),r.addRange(o))}static isAtStart(){let e=window.getSelection();if(!e||e.focusOffset>0)return!1;let n=e.focusNode;return!n||!Or(n)?!1:t.getHigherLevelSiblings(n,"left").every(o=>mN(o))}static getHigherLevelSiblings(e,n="left"){let o=e,r=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;let i=n==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],r.push(o);return r}},nK='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',gN='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',Sc=class t{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:gN,title:"List"}}constructor({data:e,config:n,api:o,readOnly:r}){var i;this.nodes={wrapper:null},this.api=o,this.readOnly=r,this.config=n,this.defaultListStyle=((i=this.config)==null?void 0:i.defaultStyle)==="ordered"?"ordered":"unordered";let s={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:s,this.caret=new gi}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:nK},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:gN}].map(e=>({name:e.name,icon:e.icon,label:e.label,isActive:this.data.style===e.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=e.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){let n=e.detail.data;this.data=this.pasteHandler(n);let o=this.nodes.wrapper;o&&o.parentNode&&o.parentNode.replaceChild(this.render(),o)}pasteHandler(e){let{tagName:n}=e,o="unordered",r;switch(n){case"OL":o="ordered",r="ol";break;case"UL":case"LI":o="unordered",r="ul"}let i={style:o,items:[]},s=a=>Array.from(a.querySelectorAll(":scope > li")).map(l=>{var c;let d=l.querySelector(`:scope > ${r}`),u=d?s(d):[];return{content:((c=l?.firstChild)==null?void 0:c.textContent)||"",items:u}});return i.items=s(e),i}appendItems(e,n){e.forEach(o=>{let r=this.createItem(o.content,o.items);n.appendChild(r)})}createItem(e,n=[]){let o=Oa("li",this.CSS.item),r=Oa("div",this.CSS.itemBody),i=Oa("div",this.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),o.appendChild(r),n&&n.length>0&&this.addChildrenList(o,n),o}save(){let e=n=>Array.from(n.querySelectorAll(`:scope > .${this.CSS.item}`)).map(o=>{let r=o.querySelector(`.${this.CSS.itemChildren}`),i=this.getItemContent(o),s=r?e(r):[];return{content:i,items:s}});return{style:this.data.style,items:this.nodes.wrapper?e(this.nodes.wrapper):[]}}addChildrenList(e,n){let o=e.querySelector(`.${this.CSS.itemBody}`),r=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(n,r),o&&o.appendChild(r)}makeListWrapper(e=this.listStyle,n=[]){let o=e==="ordered"?"ol":"ul",r=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return n.push(r),Oa(o,[this.CSS.wrapper,...n])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){if(!this.nodes||!this.nodes.wrapper)return;let n=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));n.push(this.nodes.wrapper),n.forEach(o=>{o.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),o.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return!n||(Or(n)||(n=n.parentNode),!n)||!Or(n)?null:n.closest(`.${this.CSS.item}`)}enterPressed(e){let n=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;let o=n?this.getItemContent(n).trim().length===0:!0,r=n?.parentNode===this.nodes.wrapper,i=n?.nextElementSibling===null;if(r&&i&&o){this.getOutOfList();return}else if(i&&o){this.unshiftItem();return}let s=gi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=hN(s),l=n?.querySelector(`.${this.CSS.itemChildren}`),c=this.createItem(a,void 0);l&&Array.from(l.querySelectorAll(`.${this.CSS.item}`)).length>0?l.prepend(c):n?.after(c),this.focusItem(c)}unshiftItem(){let e=this.currentItem;if(!e||!e.parentNode||!Or(e.parentNode))return;let n=e.parentNode.closest(`.${this.CSS.item}`);if(!n)return;this.caret.save(),n.after(e),this.caret.restore();let o=n.querySelector(`.${this.CSS.itemChildren}`);o&&o.children.length===0&&o.remove()}getItemContent(e){let n=e.querySelector(`.${this.CSS.itemContent}`);return!n||mN(n)?"":n.innerHTML}focusItem(e,n=!0){let o=e.querySelector(`.${this.CSS.itemContent}`);o&&gi.focus(o,n)}getOutOfList(){var e;(e=this.currentItem)==null||e.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!gi.isAtStart())return;e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!n.parentNode||!Or(n.parentNode))return;let r=n.parentNode.closest(`.${this.CSS.item}`);if(!o&&!r||o&&!Or(o))return;e.stopPropagation();let i;if(o){let d=o.querySelectorAll(`.${this.CSS.item}`);i=Array.from(d).pop()||o}else i=r;let s=gi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=hN(s);if(!i)return;let l=i.querySelector(`.${this.CSS.itemContent}`);if(!l)return;gi.focus(l,!1),this.caret.save(),l.insertAdjacentHTML("beforeend",a);let c=n.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);c=Array.from(c),c=c.filter(d=>!d.parentNode||!Or(d.parentNode)?!1:d.parentNode.closest(`.${this.CSS.item}`)===n),c.reverse().forEach(d=>{o?i.after(d):n.after(d)}),n.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!o||!Or(o)||!o)return;let r=o.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),r)r.appendChild(n);else{let i=this.makeListWrapper(void 0,[this.CSS.itemChildren]),s=o.querySelector(`.${this.CSS.itemBody}`);i.appendChild(n),s?.appendChild(i)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(n=>`${n.content} ${t.joinRecursive(n)}`).join("")}static get conversionConfig(){return{export:e=>t.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-rawtool__textarea{min-height:200px;resize:vertical;border-radius:8px;border:0;background-color:#1e2128;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:12px;line-height:1.6;letter-spacing:-.2px;color:#a1a7b6;overscroll-behavior:contain}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var oK='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.6954 5C17.912 5 18.8468 6.07716 18.6755 7.28165L17.426 16.0659C17.3183 16.8229 16.7885 17.4522 16.061 17.6873L12.6151 18.8012C12.2152 18.9304 11.7848 18.9304 11.3849 18.8012L7.93898 17.6873C7.21148 17.4522 6.6817 16.8229 6.57403 16.0659L5.32454 7.28165C5.15322 6.07716 6.088 5 7.30461 5H16.6954Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8.4H9L9.42857 11.7939H14.5714L14.3571 13.2788L14.1429 14.7636L12 15.4L9.85714 14.7636L9.77143 14.3394"/></svg>';var wp=class t{static get isReadOnlySupported(){return!0}static get displayInToolbox(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:oK,title:"Raw HTML"}}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this.placeholder=o.i18n.t(n.placeholder||t.DEFAULT_PLACEHOLDER),this.CSS={baseClass:this.api.styles.block,input:this.api.styles.input,wrapper:"ce-rawtool",textarea:"ce-rawtool__textarea"},this.data={html:e.html||""},this.textarea=null,this.resizeDebounce=null}render(){let e=document.createElement("div"),n=100;return this.textarea=document.createElement("textarea"),e.classList.add(this.CSS.baseClass,this.CSS.wrapper),this.textarea.classList.add(this.CSS.textarea,this.CSS.input),this.textarea.textContent=this.data.html,this.textarea.placeholder=this.placeholder,this.readOnly?this.textarea.disabled=!0:this.textarea.addEventListener("input",()=>{this.onInput()}),e.appendChild(this.textarea),setTimeout(()=>{this.resize()},n),e}save(e){return{html:e.querySelector("textarea").value}}static get DEFAULT_PLACEHOLDER(){return"Enter HTML code"}static get sanitize(){return{html:!0}}onInput(){this.resizeDebounce&&clearTimeout(this.resizeDebounce),this.resizeDebounce=setTimeout(()=>{this.resize()},200)}resize(){this.textarea.style.height="auto",this.textarea.style.height=this.textarea.scrollHeight+"px"}};Se();var kb=class t{static get CSS(){return""}static get shortcut(){return"CMD+SHIFT+X"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("S",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("S");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("S",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12"><path d="M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"/></svg>'}static get sanitize(){return{s:{}}}},_N=kb;var Nb=class t{static get CSS(){return""}static get shortcut(){return"CMD+."}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("SUP",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("SUP");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("SUP",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" style="stroke: none !important" /><path d="M5 7l8 10m-8 0l8 -10" /><path d="M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" /></svg>'}static get sanitize(){return{sup:{}}}},bN=Nb;var Db=class t{static get CSS(){return""}static get shortcut(){return"CMD+U"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("U",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("U");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("U",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.71429 18H16.2857" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'}static get sanitize(){return{u:{}}}},yN=Db;function xN(t){let e=J(null),[n,o]=L(null),[r,i]=L({blocks:[{type:"paragraph",data:{}}],time:0,version:""}),s=t.placeholder||"Start typing...";return F(()=>{if(!n)return;let a=t.value;if(r?.time!==a?.time){let l=r?.time||0;(a?.time||0)>l&&rK(a)&&((a?.blocks||[]).length>0?n.render(a):n.render({...a,blocks:[{type:"paragraph",data:{text:""}}]}),i(a))}},[n,t.value]),F(()=>{let a=e.current,l=up,c=new l({holder:a,placeholder:s,inlineToolbar:["bold","italic","underline","strikethrough","superscript","link"],tools:{heading:{class:vp,config:{placeholder:"Enter a header",levels:[2,3,4,5],defaultLevel:2}},strikethrough:{class:_N},superscript:{class:bN},underline:{class:yN},image:{class:Ep,config:{uploader:iK(),captionPlaceholder:"Alt text"}},unorderedList:{class:Sc,inlineToolbar:!0,config:{defaultStyle:"unordered"},toolbox:{name:"unorderedList",title:"Bulleted List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>'}},orderedList:{class:Sc,inlineToolbar:!0,config:{defaultStyle:"ordered"},toolbox:{name:"orderedList",title:"Numbered List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>'}},html:{class:wp,toolbox:{name:"HTML"}}},onReady:()=>{o(c)},onChange:()=>{c.save().then(d=>{i(d),t.onChange&&t.onChange(d)}).catch(d=>{console.error("richtext error: ",d)})}});return()=>{c&&typeof c.destroy=="function"&&c.destroy()}},[]),f("div",{ref:e,className:xe(t.className,"EditorJSEditor")})}function rK(t){return Rn(t)&&Array.isArray(t.blocks)&&t.blocks.length>0}function iK(){return{uploadByFile:async t=>{try{let e=await ai(t),n=e.src;return sK(n)&&(n=`${n}=s0-e365`),console.log(e),{success:1,file:{...e,url:n}}}catch(e){return console.error(e),{success:0,error:e}}},uploadByUrl:async t=>({success:0,error:"upload by url not currently supported"})}}function sK(t){return t.startsWith("https://lh3.googleusercontent.com/")}var nx={};$e(nx,{$addUpdateTag:()=>ID,$applyNodeReplacement:()=>Jc,$caretFromPoint:()=>Ti,$caretRangeFromSelection:()=>gy,$cloneWithProperties:()=>BD,$comparePointCaretNext:()=>Qy,$copyNode:()=>Gy,$create:()=>F3,$createLineBreakNode:()=>$a,$createNodeSelection:()=>Ay,$createParagraphNode:()=>Br,$createPoint:()=>Lo,$createRangeSelection:()=>lD,$createRangeSelectionFromDom:()=>a3,$createTabNode:()=>nf,$createTextNode:()=>Gt,$extendCaretToRange:()=>Xy,$getAdjacentChildCaret:()=>Ya,$getAdjacentNode:()=>DD,$getAdjacentSiblingOrParentSiblingCaret:()=>V3,$getCaretInDirection:()=>Si,$getCaretRange:()=>wi,$getCaretRangeInDirection:()=>tx,$getCharacterOffsets:()=>ay,$getChildCaret:()=>Hr,$getChildCaretAtIndex:()=>WD,$getChildCaretOrSelf:()=>HD,$getCollapsedCaretRange:()=>UD,$getCommonAncestor:()=>Lc,$getCommonAncestorResultBranchOrder:()=>ex,$getEditor:()=>Yy,$getNearestNodeFromDOMNode:()=>lf,$getNearestRootOrShadowRoot:()=>MD,$getNodeByKey:()=>$t,$getNodeByKeyOrThrow:()=>LD,$getPreviousSelection:()=>Ns,$getRoot:()=>$n,$getSelection:()=>ze,$getSiblingCaret:()=>Zt,$getState:()=>Fp,$getStateChange:()=>RK,$getTextContent:()=>d3,$getTextNodeOffset:()=>ks,$getTextPointCaret:()=>Ei,$getTextPointCaretSlice:()=>fy,$getWritableNodeState:()=>Ey,$hasAncestor:()=>Xp,$hasUpdateTag:()=>I3,$insertNodes:()=>c3,$isBlockElementNode:()=>s3,$isChildCaret:()=>Mo,$isDecoratorNode:()=>Xe,$isElementNode:()=>K,$isExtendableTextPointCaret:()=>VD,$isInlineElementOrDecoratorNode:()=>A3,$isLeafNode:()=>N3,$isLineBreakNode:()=>ys,$isNodeCaret:()=>z3,$isNodeSelection:()=>of,$isParagraphNode:()=>y3,$isRangeSelection:()=>fe,$isRootNode:()=>Fn,$isRootOrShadowRoot:()=>Ro,$isSiblingCaret:()=>Ss,$isTabNode:()=>Iy,$isTextNode:()=>oe,$isTextPointCaret:()=>$r,$isTextPointCaretSlice:()=>j3,$isTokenOrSegmented:()=>Lr,$isTokenOrTab:()=>bi,$nodesOfType:()=>O3,$normalizeCaret:()=>Io,$normalizeSelection__EXPERIMENTAL:()=>Bp,$onUpdate:()=>AD,$parseSerializedNode:()=>f3,$removeTextFromCaretRange:()=>jD,$rewindSiblingCaret:()=>Za,$selectAll:()=>D3,$setCompositionKey:()=>qt,$setPointFromCaret:()=>qa,$setSelection:()=>zn,$setSelectionFromCaretRange:()=>KD,$setState:()=>PK,$splitAtPointCaretNext:()=>Y3,$splitNode:()=>M3,$updateRangeSelectionFromCaretRange:()=>Rc,ArtificialNode__DO_NOT_USE:()=>Yp,BLUR_COMMAND:()=>G1,CAN_REDO_COMMAND:()=>YK,CAN_UNDO_COMMAND:()=>qK,CLEAR_EDITOR_COMMAND:()=>WK,CLEAR_HISTORY_COMMAND:()=>GK,CLICK_COMMAND:()=>D1,COLLABORATION_TAG:()=>gD,COMMAND_PRIORITY_CRITICAL:()=>w3,COMMAND_PRIORITY_EDITOR:()=>x3,COMMAND_PRIORITY_HIGH:()=>E3,COMMAND_PRIORITY_LOW:()=>v3,COMMAND_PRIORITY_NORMAL:()=>C3,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ma,COPY_COMMAND:()=>Ny,CUT_COMMAND:()=>Dy,DELETE_CHARACTER_COMMAND:()=>Uc,DELETE_LINE_COMMAND:()=>jc,DELETE_WORD_COMMAND:()=>Kc,DRAGEND_COMMAND:()=>V1,DRAGOVER_COMMAND:()=>j1,DRAGSTART_COMMAND:()=>K1,DROP_COMMAND:()=>U1,DecoratorNode:()=>Vc,ElementNode:()=>Ci,FOCUS_COMMAND:()=>W1,FORMAT_ELEMENT_COMMAND:()=>VK,FORMAT_TEXT_COMMAND:()=>mi,HISTORIC_TAG:()=>h3,HISTORY_MERGE_TAG:()=>Mp,HISTORY_PUSH_TAG:()=>g3,INDENT_CONTENT_COMMAND:()=>KK,INSERT_LINE_BREAK_COMMAND:()=>Oc,INSERT_PARAGRAPH_COMMAND:()=>Zb,INSERT_TAB_COMMAND:()=>UK,INTERNAL_$isBlock:()=>Fr,IS_ALL_FORMATTING:()=>h1,IS_BOLD:()=>mK,IS_CODE:()=>bK,IS_HIGHLIGHT:()=>Qp,IS_ITALIC:()=>_K,IS_STRIKETHROUGH:()=>Fc,IS_SUBSCRIPT:()=>yK,IS_SUPERSCRIPT:()=>xK,IS_UNDERLINE:()=>Bc,KEY_ARROW_DOWN_COMMAND:()=>P1,KEY_ARROW_LEFT_COMMAND:()=>M1,KEY_ARROW_RIGHT_COMMAND:()=>I1,KEY_ARROW_UP_COMMAND:()=>R1,KEY_BACKSPACE_COMMAND:()=>B1,KEY_DELETE_COMMAND:()=>z1,KEY_DOWN_COMMAND:()=>O1,KEY_ENTER_COMMAND:()=>Up,KEY_ESCAPE_COMMAND:()=>$1,KEY_MODIFIER_COMMAND:()=>Y1,KEY_SPACE_COMMAND:()=>F1,KEY_TAB_COMMAND:()=>H1,LineBreakNode:()=>Ba,MOVE_TO_END:()=>A1,MOVE_TO_START:()=>L1,NODE_STATE_KEY:()=>NK,OUTDENT_CONTENT_COMMAND:()=>jK,PASTE_COMMAND:()=>Ty,PASTE_TAG:()=>m3,ParagraphNode:()=>Ua,REDO_COMMAND:()=>ky,REMOVE_TEXT_COMMAND:()=>Qb,RootNode:()=>Ha,SELECTION_CHANGE_COMMAND:()=>wy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>HK,SELECT_ALL_COMMAND:()=>ey,SKIP_COLLAB_TAG:()=>_3,SKIP_DOM_SELECTION_TAG:()=>_D,SKIP_SCROLL_INTO_VIEW_TAG:()=>mD,TEXT_TYPE_TO_FORMAT:()=>hn,TabNode:()=>za,TextNode:()=>Es,UNDO_COMMAND:()=>Sy,buildImportMap:()=>ZK,createCommand:()=>Ee,createEditor:()=>T3,createSharedNodeState:()=>v1,createState:()=>LK,flipDirection:()=>ki,getDOMOwnerDocument:()=>Vy,getDOMSelection:()=>or,getDOMSelectionFromTarget:()=>RD,getDOMTextNode:()=>Ts,getEditorPropertyFromDOMNode:()=>Yc,getNearestEditorFromDOMNode:()=>zy,getRegisteredNode:()=>By,getRegisteredNodeOrThrow:()=>Fy,isBlockDomNode:()=>uy,isCurrentlyReadOnlyMode:()=>Ja,isDOMDocumentNode:()=>xD,isDOMNode:()=>Xa,isDOMTextNode:()=>rr,isDOMUnmanaged:()=>zD,isDocumentFragment:()=>PD,isExactShortcutMatch:()=>Ge,isHTMLAnchorElement:()=>L3,isHTMLElement:()=>kn,isInlineDomNode:()=>FD,isLexicalEditor:()=>sf,isModifierMatch:()=>ND,isSelectionCapturedInDecoratorInput:()=>$y,isSelectionWithinEditor:()=>Gc,makeStepwiseIterator:()=>Zy,removeFromParent:()=>yi,resetRandomKey:()=>S3,setDOMUnmanaged:()=>P3,setNodeIndentFromDOM:()=>$D});function V(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Po=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,aK=Po&&"documentMode"in document?document.documentMode:null,nr=Po&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xs=Po&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Lp=!(!Po||!("InputEvent"in window)||aK)&&"getTargetRanges"in new window.InputEvent("input"),Pc=Po&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Pa=Po&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lK=Po&&/Android/.test(navigator.userAgent),p1=Po&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vN=Po&&lK&&p1,Rp=Po&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!p1;function Pp(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var cK=1,dK=3,uK=9,pK=11,vs=0,f1=1,Fa=2,fK=0,hK=1,gK=2,mK=1,_K=2,Fc=4,Bc=8,bK=16,yK=32,xK=64,Qp=128,h1=1792|(112|(3|Fc|Bc)|Qp),my=1,_y=2,by=3,yy=4,xy=5,vy=6,ef=Pc||Pa||Rp?"\xA0":"\u200B",zr=`
104
+
105
+ `,vK=xs?"\xA0":ef,g1="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",m1="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",CK=new RegExp("^[^"+m1+"]*["+g1+"]"),EK=new RegExp("^[^"+g1+"]*["+m1+"]"),hn={bold:1,capitalize:1024,code:16,highlight:Qp,italic:2,lowercase:256,strikethrough:Fc,subscript:32,superscript:64,underline:Bc,uppercase:512},wK={directionless:1,unmergeable:2},CN={center:_y,end:vy,justify:yy,left:my,right:by,start:xy},TK={[_y]:"center",[vy]:"end",[yy]:"justify",[my]:"left",[by]:"right",[xy]:"start"},SK={normal:0,segmented:2,token:1},kK={[fK]:"normal",[gK]:"segmented",[hK]:"token"},NK="$",EN="$config";function _1(t,e,n,o,r,i){let s=t.getFirstChild();for(;s!==null;){let a=s.__key;s.__parent===e&&(K(s)&&_1(s,a,n,o,r,i),n.has(a)||i.delete(a),r.push(a)),s=s.getNextSibling()}}var DK=100,Kb=!1,Cy=0;function OK(t){Cy=t.timeStamp}function Ob(t,e,n){let o=t.nodeName==="BR",r=e.__lexicalLineBreak;return r&&(t===r||o&&t.previousSibling===r)||o&&af(t,n)!==void 0}function IK(t,e,n){let o=or(Co(n)),r=null,i=null;o!==null&&o.anchorNode===t&&(r=o.anchorOffset,i=o.focusOffset);let s=t.nodeValue;s!==null&&Ky(e,s,r,i,!1)}function AK(t,e,n){if(fe(t)){let o=t.anchor.getNode();if(o.is(n)&&t.format!==o.getFormat())return!1}return rr(e)&&n.isAttached()}function MK(t,e,n,o){for(let r=t;r&&!zD(r);r=qc(r)){let i=af(r,e);if(i!==void 0){let s=$t(i,n);if(s)return Xe(s)||!kn(r)?void 0:[r,s]}else if(r===o)return[o,wD(n)]}}function b1(t,e,n){Kb=!0;let o=performance.now()-Cy>DK;try{ro(t,(()=>{let r=ze()||(function(p){return p.getEditorState().read((()=>{let h=ze();return h!==null?h.clone():null}))})(t),i=new Map,s=t.getRootElement(),a=t._editorState,l=t._blockCursorElement,c=!1,d="";for(let p=0;p<e.length;p++){let h=e[p],g=h.type,m=h.target,_=MK(m,t,a,s);if(!_)continue;let[b,y]=_;if(g==="characterData")o&&oe(y)&&rr(m)&&AK(r,m,y)&&IK(m,y,t);else if(g==="childList"){c=!0;let v=h.addedNodes;for(let E=0;E<v.length;E++){let k=v[E],T=CD(k),w=k.parentNode;if(w!=null&&k!==l&&T===null&&!Ob(k,w,t)){if(xs){let S=(kn(k)?k.innerText:null)||k.nodeValue;S&&(d+=S)}w.removeChild(k)}}let x=h.removedNodes,C=x.length;if(C>0){let E=0;for(let k=0;k<C;k++){let T=x[k];(Ob(T,m,t)||l===T)&&(m.appendChild(T),E++)}C!==E&&i.set(b,y)}}}if(i.size>0)for(let[p,h]of i)h.reconcileObservedMutation(p,t);let u=n.takeRecords();if(u.length>0){for(let p=0;p<u.length;p++){let h=u[p],g=h.addedNodes,m=h.target;for(let _=0;_<g.length;_++){let b=g[_],y=b.parentNode;y==null||b.nodeName!=="BR"||Ob(b,m,t)||y.removeChild(b)}}n.takeRecords()}r!==null&&(c&&zn(r),xs&&OD(t)&&r.insertRawText(d))}))}finally{Kb=!1}}function y1(t){let e=t._observer;e!==null&&b1(t,e.takeRecords(),e)}function x1(t){(function(e){Cy===0&&Co(e).addEventListener("textInput",OK,!0)})(t),t._observer=new MutationObserver(((e,n)=>{b1(t,e,n)}))}var jb=class{constructor(e,n){this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||FK).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function LK(t,e){return new jb(t,e)}function Fp(t,e,n="latest"){let o=(n==="latest"?t.getLatest():t).__state;return o?o.getValue(e):e.defaultValue}function RK(t,e,n){let o=Fp(t,n,"direct"),r=Fp(e,n,"direct");return n.isEqual(o,r)?null:[o,r]}function PK(t,e,n){let o;if(Yt(),typeof n=="function"){let i=t.getLatest(),s=Fp(i,e);if(o=n(s),e.isEqual(s,o))return i}else o=n;let r=t.getWritable();return Ey(r).updateFromKnown(e,o),r}function v1(t){let e=new Map,n=new Set;for(let o=typeof t=="function"?t:t.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=qy(o);if(r&&r.stateConfigs)for(let i of r.stateConfigs){let s;"stateConfig"in i?(s=i.stateConfig,i.flat&&n.add(s.key)):s=i,e.set(s.key,s)}}return{flatKeys:n,sharedConfigMap:e}}var Vb=class t{constructor(e,n,o=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,c,d){let u=d.size;if(c)for(let p in c){let h=l.get(p);h&&d.has(h)||u++}return u})(s,o,r);this.size=a}getValue(e){let n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let o=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let r=this.unknownState[e.key];r!==void 0&&(o=e.parse(r)),this.updateFromKnown(e,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete e[o.key]:e[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in e&&(n[o]=e[o],delete e[o]);return wN(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new t(e,n,(function(i,s,a){let l;if(a)for(let[c,d]of Object.entries(a)){let u=i.get(c);u?s.has(u)||s.set(u,u.parse(d)):(l=l||{},l[c]=d)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(e,n){let o=e.key;this.sharedNodeState.sharedConfigMap.set(o,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&o in i||(i&&(delete i[o],this.unknownState=wN(i)),this.size++),r.set(e,n)}updateFromUnknown(e,n){let o=this.sharedNodeState.sharedConfigMap.get(e);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(let[o,r]of Object.entries(e))this.updateFromUnknown(o,r)}};function Ey(t){let e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Vb(e,C1(e));return e.__state=n,n}function C1(t){return t.__state?t.__state.sharedNodeState:Fy(Yy(),t.getType()).sharedNodeState}function wN(t){if(t)for(let e in t)return t}function FK(t){return t}function TN(t,e,n){for(let[o,r]of e.knownState){if(t.has(o.key))continue;t.add(o.key);let i=n?n.getValue(o):o.defaultValue;if(i!==r&&!o.isEqual(i,r))return!0}return!1}function SN(t,e,n){let{unknownState:o}=e,r=n?n.unknownState:void 0;if(o){for(let[i,s]of Object.entries(o))if(!t.has(i)&&(t.add(i),s!==(r?r[i]:void 0)))return!0}return!1}function kN(t,e){let n=t.__state;return n&&n.node===t?n.getWritable(e):n}function NN(t,e){let n=t.__mode,o=t.__format,r=t.__style,i=e.__mode,s=e.__format,a=e.__style,l=t.__state,c=e.__state;return(n===null||n===i)&&(o===null||o===s)&&(r===null||r===a)&&(t.__state===null||l===c||(function(d,u){if(d===u)return!0;if(d&&u&&d.size!==u.size)return!1;let p=new Set;return!(d&&TN(p,d,u)||u&&TN(p,u,d)||d&&SN(p,d,u)||u&&SN(p,u,d))})(l,c))}function DN(t,e){let n=t.mergeWithSibling(e),o=st()._normalizedNodes;return o.add(t.__key),o.add(e.__key),n}function ON(t){let e,n,o=t;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(e=o.getPreviousSibling())!==null&&oe(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(NN(e,o)){o=DN(e,o);break}break}e.remove()}for(;(n=o.getNextSibling())!==null&&oe(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(NN(o,n)){o=DN(o,n);break}break}n.remove()}}else o.remove()}function Bp(t){return IN(t.anchor),IN(t.focus),t}function IN(t){for(;t.type==="element";){let e=t.getNode(),n=t.offset,o,r;if(n===e.getChildrenSize()?(o=e.getChildAtIndex(n-1),r=!0):(o=e.getChildAtIndex(n),r=!1),oe(o)){t.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!K(o))break;t.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var xi,Sn,$c,tf,Wb,Gb,Cs,Ao,Yb,zc,Bt="",Tn="",er=null,tr="",Rr="",E1=!1,Hc=!1,Op=null;function $p(t,e){let n=Cs.get(t);if(e!==null){let o=Xb(t);o.parentNode===e&&e.removeChild(o)}if(Ao.has(t)||Sn._keyToDOMMap.delete(t),K(n)){let o=Hp(n,Cs);qb(o,0,o.length-1,null)}n!==void 0&&jy(zc,$c,tf,n,"destroyed")}function qb(t,e,n,o){let r=e;for(;r<=n;++r){let i=t[r];i!==void 0&&$p(i,o)}}function _s(t,e){t.setProperty("text-align",e)}var BK="40px";function w1(t,e){let n=xi.theme.indent;if(typeof n=="string"){let r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}let o=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||BK;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${o})`)}function T1(t,e){let n=t.style;e===0?_s(n,""):e===my?_s(n,"left"):e===_y?_s(n,"center"):e===by?_s(n,"right"):e===yy?_s(n,"justify"):e===xy?_s(n,"start"):e===vy&&_s(n,"end")}function zp(t,e){let n=Ao.get(t);n===void 0&&V(60);let o=n.createDOM(xi,Sn);if((function(r,i,s){let a=s._keyToDOMMap;(function(l,c,d){let u=`__lexicalKey_${c._key}`;l[u]=d})(i,s,r),a.set(r,i)})(t,o,Sn),oe(n)?o.setAttribute("data-lexical-text","true"):Xe(n)&&o.setAttribute("data-lexical-decorator","true"),K(n)){let r=n.__indent,i=n.__size;if(r!==0&&w1(o,r),i!==0){let a=i-1;(function(l,c,d,u){let p=Tn;Tn="",Jb(l,d,0,c,d.getDOMSlot(u)),k1(d,u),Tn=p})(Hp(n,Ao),a,n,o)}let s=n.__format;s!==0&&T1(o,s),n.isInline()||S1(null,n,o),cf(n)&&(Bt+=zr,Rr+=zr)}else{let r=n.getTextContent();if(Xe(n)){let i=n.decorate(Sn,xi);i!==null&&N1(t,i),o.contentEditable="false"}else oe(n)&&(n.isDirectionless()||(Tn+=r));Bt+=r,Rr+=r}return e!==null&&e.insertChild(o),jy(zc,$c,tf,n,"created"),o}function Jb(t,e,n,o,r){let i=Bt;Bt="";let s=n;for(;s<=o;++s){zp(t[s],r);let a=Ao.get(t[s]);a!==null&&oe(a)&&(er===null&&(er=a.getFormat()),tr===""&&(tr=a.getStyle()))}cf(e)&&(Bt+=zr),r.element.__lexicalTextContent=Bt,Bt=i+Bt}function AN(t,e){if(t){let n=t.__last;if(n){let o=e.get(n);if(o)return ys(o)?"line-break":Xe(o)&&o.isInline()?"decorator":null}return"empty"}return null}function S1(t,e,n){let o=AN(t,Cs),r=AN(e,Ao);o!==r&&e.getDOMSlot(n).setManagedLineBreak(r)}function k1(t,e){let n=e.__lexicalDirTextContent||"",o=e.__lexicalDir||"";if(n!==Tn||o!==Op){let r=Tn==="",i=r?Op:(function(s){return CK.test(s)?"rtl":EK.test(s)?"ltr":null})(Tn);if(i!==o){let s=e.classList,a=xi.theme,l=o!==null?a[o]:void 0,c=i!==null?a[i]:void 0;if(l!==void 0){if(typeof l=="string"){let d=Pp(l);l=a[o]=d}s.remove(...l)}if(i===null||r&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){let d=Pp(c);c=a[i]=d}c!==void 0&&s.add(...c)}e.dir=i}Hc||(t.getWritable().__dir=i)}Op=i,e.__lexicalDirTextContent=Tn,e.__lexicalDir=i}}function $K(t,e,n){let o=Tn;var r;Tn="",er=null,tr="",(function(i,s,a){let l=Bt,c=i.__size,d=s.__size;Bt="";let u=a.element;if(c===1&&d===1){let p=i.__first,h=s.__first;if(p===h)Dc(p,u);else{let m=Xb(p),_=zp(h,null);try{u.replaceChild(_,m)}catch(b){if(typeof b=="object"&&b!=null){let y=`${b.toString()} Parent: ${u.tagName}, new child: {tag: ${_.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${p}}.`;throw new Error(y)}throw b}$p(p,null)}let g=Ao.get(h);oe(g)&&(er===null&&(er=g.getFormat()),tr===""&&(tr=g.getStyle()))}else{let p=Hp(i,Cs),h=Hp(s,Ao);if(p.length!==c&&V(227),h.length!==d&&V(228),c===0)d!==0&&Jb(h,s,0,d-1,a);else if(d===0){if(c!==0){let g=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;qb(p,0,c-1,g?null:u),g&&(u.textContent="")}}else(function(g,m,_,b,y,v){let x=b-1,C=y-1,E,k,T=v.getFirstChild(),w=0,S=0;for(;w<=x&&S<=C;){let O=m[w],A=_[S];if(O===A)T=Ib(Dc(A,v.element)),w++,S++;else{E===void 0&&(E=new Set(m)),k===void 0&&(k=new Set(_));let R=k.has(O),$=E.has(A);if(R)if($){let W=ja(Sn,A);W===T?T=Ib(Dc(A,v.element)):(v.withBefore(T).insertChild(W),Dc(A,v.element)),w++,S++}else zp(A,v.withBefore(T)),S++;else T=Ib(Xb(O)),$p(O,v.element),w++}let I=Ao.get(A);I!==null&&oe(I)&&(er===null&&(er=I.getFormat()),tr===""&&(tr=I.getStyle()))}let N=w>x,D=S>C;if(N&&!D){let O=_[C+1],A=O===void 0?null:Sn.getElementByKey(O);Jb(_,g,S,C,v.withBefore(A))}else D&&!N&&qb(m,w,x,v.element)})(s,p,h,c,d,a)}cf(s)&&(Bt+=zr),u.__lexicalTextContent=Bt,Bt=l+Bt})(t,e,e.getDOMSlot(n)),k1(e,n),r=e,er==null||er===r.__textFormat||Hc||r.setTextFormat(er),(function(i){tr===""||tr===i.__textStyle||Hc||i.setTextStyle(tr)})(e),Tn=o}function Hp(t,e){let n=[],o=t.__first;for(;o!==null;){let r=e.get(o);r===void 0&&V(101),n.push(o),o=r.__next}return n}function Dc(t,e){let n=Cs.get(t),o=Ao.get(t);n!==void 0&&o!==void 0||V(61);let r=E1||Gb.has(t)||Wb.has(t),i=ja(Sn,t);if(n===o&&!r){if(K(n)){let s=i.__lexicalTextContent;s!==void 0&&(Bt+=s,Rr+=s);let a=i.__lexicalDirTextContent;a!==void 0&&(Tn+=a)}else{let s=n.getTextContent();oe(n)&&!n.isDirectionless()&&(Tn+=s),Rr+=s,Bt+=s}return i}if(n!==o&&r&&jy(zc,$c,tf,o,"updated"),o.updateDOM(n,i,xi)){let s=zp(t,null);return e===null&&V(62),e.replaceChild(s,i),$p(t,null),s}if(K(n)&&K(o)){let s=o.__indent;s!==n.__indent&&w1(i,s);let a=o.__format;a!==n.__format&&T1(i,a),r&&($K(n,o,i),Fn(o)||o.isInline()||S1(n,o,i)),cf(o)&&(Bt+=zr,Rr+=zr)}else{let s=o.getTextContent();if(Xe(o)){let a=o.decorate(Sn,xi);a!==null&&N1(t,a)}else oe(o)&&!o.isDirectionless()&&(Tn+=s);Bt+=s,Rr+=s}if(!Hc&&Fn(o)&&o.__cachedText!==Rr){let s=o.getWritable();s.__cachedText=Rr,o=s}return i}function N1(t,e){let n=Sn._pendingDecorators,o=Sn._decorators;if(n===null){if(o[t]===e)return;n=ED(Sn)}n[t]=e}function Ib(t){let e=t.nextSibling;return e!==null&&e===Sn._blockCursorElement&&(e=e.nextSibling),e}function zK(t,e,n,o,r,i){Bt="",Rr="",Tn="",E1=o===Fa,Op=null,Sn=n,xi=n._config,$c=n._nodes,tf=Sn._listeners.mutation,Wb=r,Gb=i,Cs=t._nodeMap,Ao=e._nodeMap,Hc=e._readOnly,Yb=new Map(n._keyToDOMMap);let s=new Map;return zc=s,Dc("root",null),Sn=void 0,$c=void 0,Wb=void 0,Gb=void 0,Cs=void 0,Ao=void 0,xi=void 0,Yb=void 0,zc=void 0,s}function Xb(t){let e=Yb.get(t);return e===void 0&&V(75,t),e}function Ee(t){return{type:t}}var wy=Ee("SELECTION_CHANGE_COMMAND"),HK=Ee("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),D1=Ee("CLICK_COMMAND"),Uc=Ee("DELETE_CHARACTER_COMMAND"),Oc=Ee("INSERT_LINE_BREAK_COMMAND"),Zb=Ee("INSERT_PARAGRAPH_COMMAND"),Ma=Ee("CONTROLLED_TEXT_INSERTION_COMMAND"),Ty=Ee("PASTE_COMMAND"),Qb=Ee("REMOVE_TEXT_COMMAND"),Kc=Ee("DELETE_WORD_COMMAND"),jc=Ee("DELETE_LINE_COMMAND"),mi=Ee("FORMAT_TEXT_COMMAND"),Sy=Ee("UNDO_COMMAND"),ky=Ee("REDO_COMMAND"),O1=Ee("KEYDOWN_COMMAND"),I1=Ee("KEY_ARROW_RIGHT_COMMAND"),A1=Ee("MOVE_TO_END"),M1=Ee("KEY_ARROW_LEFT_COMMAND"),L1=Ee("MOVE_TO_START"),R1=Ee("KEY_ARROW_UP_COMMAND"),P1=Ee("KEY_ARROW_DOWN_COMMAND"),Up=Ee("KEY_ENTER_COMMAND"),F1=Ee("KEY_SPACE_COMMAND"),B1=Ee("KEY_BACKSPACE_COMMAND"),$1=Ee("KEY_ESCAPE_COMMAND"),z1=Ee("KEY_DELETE_COMMAND"),H1=Ee("KEY_TAB_COMMAND"),UK=Ee("INSERT_TAB_COMMAND"),KK=Ee("INDENT_CONTENT_COMMAND"),jK=Ee("OUTDENT_CONTENT_COMMAND"),U1=Ee("DROP_COMMAND"),VK=Ee("FORMAT_ELEMENT_COMMAND"),K1=Ee("DRAGSTART_COMMAND"),j1=Ee("DRAGOVER_COMMAND"),V1=Ee("DRAGEND_COMMAND"),Ny=Ee("COPY_COMMAND"),Dy=Ee("CUT_COMMAND"),ey=Ee("SELECT_ALL_COMMAND"),WK=Ee("CLEAR_EDITOR_COMMAND"),GK=Ee("CLEAR_HISTORY_COMMAND"),YK=Ee("CAN_REDO_COMMAND"),qK=Ee("CAN_UNDO_COMMAND"),W1=Ee("FOCUS_COMMAND"),G1=Ee("BLUR_COMMAND"),Y1=Ee("KEY_MODIFIER_COMMAND"),Ir=Object.freeze({}),ty=30,ny=[["keydown",function(t,e){if(Ic=t.timeStamp,q1=t.key,!e.isComposing()&&!Q(e,O1,t)&&t.key!=null){if(Ab&&s1(t))return ro(e,(()=>{Tp(e,Mb)})),Ab=!1,void(Mb="");if((function(n){return Ge(n,"ArrowRight",{shiftKey:"any"})})(t))Q(e,I1,t);else if((function(n){return Ge(n,"ArrowRight",Mr)})(t))Q(e,A1,t);else if((function(n){return Ge(n,"ArrowLeft",{shiftKey:"any"})})(t))Q(e,M1,t);else if((function(n){return Ge(n,"ArrowLeft",Mr)})(t))Q(e,L1,t);else if((function(n){return Ge(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(t))Q(e,R1,t);else if((function(n){return Ge(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(t))Q(e,P1,t);else if((function(n){return Ge(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(t))Ac=!0,Q(e,Up,t);else if((function(n){return n.key===" "})(t))Q(e,F1,t);else if((function(n){return nr&&Ge(n,"o",{ctrlKey:!0})})(t))t.preventDefault(),Ac=!0,Q(e,Oc,!0);else if((function(n){return Ge(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(t))Ac=!1,Q(e,Up,t);else if((function(n){return Ge(n,"Backspace",{shiftKey:"any"})||nr&&Ge(n,"h",{ctrlKey:!0})})(t))s1(t)?Q(e,B1,t):(t.preventDefault(),Q(e,Uc,!0));else if((function(n){return n.key==="Escape"})(t))Q(e,$1,t);else if((function(n){return Ge(n,"Delete",{})||nr&&Ge(n,"d",{ctrlKey:!0})})(t))(function(n){return n.key==="Delete"})(t)?Q(e,z1,t):(t.preventDefault(),Q(e,Uc,!1));else if((function(n){return Ge(n,"Backspace",i1)})(t))t.preventDefault(),Q(e,Kc,!0);else if((function(n){return Ge(n,"Delete",i1)})(t))t.preventDefault(),Q(e,Kc,!1);else if((function(n){return nr&&Ge(n,"Backspace",{metaKey:!0})})(t))t.preventDefault(),Q(e,jc,!0);else if((function(n){return nr&&(Ge(n,"Delete",{metaKey:!0})||Ge(n,"k",{ctrlKey:!0}))})(t))t.preventDefault(),Q(e,jc,!1);else if((function(n){return Ge(n,"b",Mr)})(t))t.preventDefault(),Q(e,mi,"bold");else if((function(n){return Ge(n,"u",Mr)})(t))t.preventDefault(),Q(e,mi,"underline");else if((function(n){return Ge(n,"i",Mr)})(t))t.preventDefault(),Q(e,mi,"italic");else if((function(n){return Ge(n,"Tab",{shiftKey:"any"})})(t))Q(e,H1,t);else if((function(n){return Ge(n,"z",Mr)})(t))t.preventDefault(),Q(e,Sy,void 0);else if((function(n){return nr?Ge(n,"z",{metaKey:!0,shiftKey:!0}):Ge(n,"y",{ctrlKey:!0})||Ge(n,"z",{ctrlKey:!0,shiftKey:!0})})(t))t.preventDefault(),Q(e,ky,void 0);else{let n=e._editorState._selection;n===null||fe(n)?a1(t)&&(t.preventDefault(),Q(e,ey,t)):(function(o){return Ge(o,"c",Mr)})(t)?(t.preventDefault(),Q(e,Ny,t)):(function(o){return Ge(o,"x",Mr)})(t)?(t.preventDefault(),Q(e,Dy,t)):a1(t)&&(t.preventDefault(),Q(e,ey,t))}(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(t)&&Q(e,Y1,t)}}],["pointerdown",function(t,e){let n=t.target,o=t.pointerType;Xa(n)&&o!=="touch"&&o!=="pen"&&t.button===0&&ro(e,(()=>{n1(n)||(ry=!0)}))}],["compositionstart",function(t,e){ro(e,(()=>{let n=ze();if(fe(n)&&!e.isComposing()){let o=n.anchor,r=n.anchor.getNode();qt(o.key),(t.timeStamp<Ic+ty||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||oe(r)&&r.getStyle()!==n.style)&&Q(e,Ma,vK)}}))}],["compositionend",function(t,e){xs?kc=!0:Pa||!Pc&&!Rp?ro(e,(()=>{Tp(e,t.data)})):(Ab=!0,Mb=t.data)}],["input",function(t,e){t.stopPropagation(),ro(e,(()=>{if(kn(t.target)&&n1(t.target))return;let n=ze(),o=t.data,r=eD(t);if(o!=null&&fe(n)&&Z1(n,r,o,t.timeStamp,!1)){kc&&(Tp(e,o),kc=!1);let i=n.anchor.getNode(),s=or(Co(e));if(s===null)return;let a=n.isBackward(),l=a?n.anchor.offset:n.focus.offset,c=a?n.focus.offset:n.anchor.offset;Lp&&!n.isCollapsed()&&oe(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,l)+o+i.getTextContent().slice(l+c)===kD(s.anchorNode)||Q(e,Ma,o);let d=o.length;xs&&d>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(n.anchor.offset-=d),Pc||Pa||Rp||!e.isComposing()||(Ic=0,qt(null))}else Uy(!1,e,o!==null?o:void 0),kc&&(Tp(e,o||void 0),kc=!1);(function(){Yt();let i=st();y1(i)})()}),{event:t}),Ia=null}],["click",function(t,e){ro(e,(()=>{let n=ze(),o=or(Co(e)),r=Ns();if(o){if(fe(n)){let i=n.anchor,s=i.getNode();if(i.type==="element"&&i.offset===0&&n.isCollapsed()&&!Fn(s)&&$n().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(t.detail===3&&!n.isCollapsed()&&s!==n.focus.getNode()){let a=(function(l,c){let d=l;for(;d!==$n()&&d!=null;){if(c(d))return d;d=d.getParent()}return null})(s,(l=>K(l)&&!l.isInline()));K(a)&&a.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=o.anchorNode;(kn(i)||rr(i))&&zn(rf(r,o,e,t))}}Q(e,D1,t)}))}],["cut",Ir],["copy",Ir],["dragstart",Ir],["dragover",Ir],["dragend",Ir],["paste",Ir],["focus",Ir],["blur",Ir],["drop",Ir]];Lp&&ny.push(["beforeinput",(t,e)=>(function(n,o){let r=n.inputType,i=eD(n);r==="deleteCompositionText"||xs&&OD(o)||r!=="insertCompositionText"&&ro(o,(()=>{let s=ze();if(r==="deleteContentBackward"){if(s===null){let h=Ns();if(!fe(h))return;zn(h.clone())}if(fe(s)){let h=s.anchor.key===s.focus.key;if(a=n.timeStamp,q1==="MediaLast"&&a<Ic+ty&&o.isComposing()&&h){if(qt(null),Ic=0,setTimeout((()=>{ro(o,(()=>{qt(null)}))}),ty),fe(s)){let g=s.anchor.getNode();g.markDirty(),oe(g)||V(142),Q1(s,g)}}else{qt(null),n.preventDefault();let g=s.anchor.getNode(),m=g.getTextContent(),_=g.canInsertTextAfter(),b=s.anchor.offset===0&&s.focus.offset===m.length,y=vN&&h&&!b&&_;if(y&&s.isCollapsed()&&(y=!Xe(DD(s.anchor,!0))),!y){Q(o,Uc,!0);let v=ze();vN&&fe(v)&&v.isCollapsed()&&(bs=v,setTimeout((()=>bs=null)))}}return}}var a;if(!fe(s))return;let l=n.data;Ia!==null&&Uy(!1,o,Ia),s.dirty&&Ia===null||!s.isCollapsed()||Fn(s.anchor.getNode())||i===null||s.applyDOMRange(i),Ia=null;let c=s.anchor,d=s.focus,u=c.getNode(),p=d.getNode();if(r!=="insertText"&&r!=="insertTranspose")switch(n.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Q(o,Ma,n);break;case"insertFromComposition":qt(null),Q(o,Ma,n);break;case"insertLineBreak":qt(null),Q(o,Oc,!1);break;case"insertParagraph":qt(null),Ac&&!Pa?(Ac=!1,Q(o,Oc,!1)):Q(o,Zb,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Q(o,Ty,n);break;case"deleteByComposition":(function(h,g){return h!==g||K(h)||K(g)||!bi(h)||!bi(g)})(u,p)&&Q(o,Qb,n);break;case"deleteByDrag":case"deleteByCut":Q(o,Qb,n);break;case"deleteContent":Q(o,Uc,!1);break;case"deleteWordBackward":Q(o,Kc,!0);break;case"deleteWordForward":Q(o,Kc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Q(o,jc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Q(o,jc,!1);break;case"formatStrikeThrough":Q(o,mi,"strikethrough");break;case"formatBold":Q(o,mi,"bold");break;case"formatItalic":Q(o,mi,"italic");break;case"formatUnderline":Q(o,mi,"underline");break;case"historyUndo":Q(o,Sy,void 0);break;case"historyRedo":Q(o,ky,void 0)}else{if(l===`
106
+ `)n.preventDefault(),Q(o,Oc,!1);else if(l===zr)n.preventDefault(),Q(o,Zb,void 0);else if(l==null&&n.dataTransfer){let h=n.dataTransfer.getData("text/plain");n.preventDefault(),s.insertRawText(h)}else l!=null&&Z1(s,i,l,n.timeStamp,!0)?(n.preventDefault(),Q(o,Ma,l)):Ia=l;J1=n.timeStamp}}))})(t,e)]);var Ic=0,q1=null,J1=0,Ia=null,Kp=new WeakMap,oy=!1,ry=!1,Ac=!1,kc=!1,Ab=!1,Mb="",bs=null,X1=[0,"",0,"root",0];function Z1(t,e,n,o,r){let i=t.anchor,s=t.focus,a=i.getNode(),l=st(),c=or(Co(l)),d=c!==null?c.anchorNode:null,u=i.key,p=l.getElementByKey(u),h=n.length;return u!==s.key||!oe(a)||(!r&&(!Lp||J1<o+50)||a.isDirty()&&h<2||TD(n))&&i.offset!==s.offset&&!a.isComposing()||Lr(a)||a.isDirty()&&h>1||(r||!Lp)&&p!==null&&!a.isComposing()&&d!==Ts(p)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||a.getFormat()!==t.format||a.getStyle()!==t.style||(function(g,m){if(m.isSegmented())return!0;if(!g.isCollapsed())return!1;let _=g.anchor.offset,b=m.getParentOrThrow(),y=bi(m);return _===0?!m.canInsertTextBefore()||!b.canInsertTextBefore()&&!m.isComposing()||y||(function(v){let x=v.getPreviousSibling();return(oe(x)||K(x)&&x.isInline())&&!x.canInsertTextAfter()})(m):_===m.getTextContentSize()&&(!m.canInsertTextAfter()||!b.canInsertTextAfter()&&!m.isComposing()||y)})(t,a)}function MN(t,e){return rr(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function LN(t,e,n){let{anchorNode:o,anchorOffset:r,focusNode:i,focusOffset:s}=t;oy&&(oy=!1,MN(o,r)&&MN(i,s)&&!bs)||ro(e,(()=>{if(!n)return void zn(null);if(!Gc(e,o,i))return;let a=ze();if(bs&&fe(a)&&a.isCollapsed()){let l=a.anchor,c=bs.anchor;(l.key===c.key&&l.offset===c.offset+1||l.offset===1&&c.getNode().is(l.getNode().getPreviousSibling()))&&(a=bs.clone(),zn(a))}if(bs=null,fe(a)){let l=a.anchor,c=l.getNode();if(a.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(a.dirty=!0);let d=Co(e).event,u=d?d.timeStamp:performance.now(),[p,h,g,m,_]=X1,b=$n(),y=e.isComposing()===!1&&b.getTextContent()==="";if(u<_+200&&l.offset===g&&l.key===m)Ip(a,p,h);else if(l.type==="text")oe(c)||V(141),Q1(a,c);else if(l.type==="element"&&!y){K(c)||V(259);let v=l.getNode();v.isEmpty()?(function(x,C){let E=C.getTextFormat(),k=C.getTextStyle();Ip(x,E,k)})(a,v):Ip(a,0,"")}}else{let d=l.key,u=a.focus.key,p=a.getNodes(),h=p.length,g=a.isBackward(),m=g?s:r,_=g?r:s,b=g?u:d,y=g?d:u,v=h1,x=!1;for(let C=0;C<h;C++){let E=p[C],k=E.getTextContentSize();if(oe(E)&&k!==0&&!(C===0&&E.__key===b&&m===k||C===h-1&&E.__key===y&&_===0)&&(x=!0,v&=E.getFormat(),v===0))break}a.format=x?v:0}}Q(e,wy,void 0)}))}function Ip(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function Q1(t,e){Ip(t,e.getFormat(),e.getStyle())}function eD(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function Tp(t,e){let n=t._compositionKey;if(qt(null),n!==null&&e!=null){if(e===""){let o=$t(n),r=Ts(t.getElementByKey(n));return void(r!==null&&r.nodeValue!==null&&oe(o)&&Ky(o,r.nodeValue,null,null,!0))}if(e[e.length-1]===`
107
+ `){let o=ze();if(fe(o)){let r=o.focus;return o.anchor.set(r.key,r.offset,r.type),void Q(t,Up,null)}}}Uy(!0,t,e)}function tD(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var La=new Map;function nD(t){let e=RD(t.target);if(e===null)return;let n=zy(e.anchorNode);if(n===null)return;ry&&(ry=!1,ro(n,(()=>{let l=Ns(),c=e.anchorNode;(kn(c)||rr(c))&&zn(rf(l,e,n,t))})));let o=Hy(n),r=o[o.length-1],i=r._key,s=La.get(i),a=s||r;a!==n&&LN(e,a,!1),LN(e,n,!0),n!==r?La.set(i,n):s&&La.delete(i)}function RN(t){t._lexicalHandled=!0}function PN(t){return t._lexicalHandled===!0}var JK=()=>{};function XK(t){let e=t.ownerDocument,n=Kp.get(e);if(n===void 0)return void JK();let o=n-1;o>=0||V(164),Kp.set(e,o),o===0&&e.removeEventListener("selectionchange",nD);let r=Yc(t);sf(r)?((function(s){if(s._parentEditor!==null){let a=Hy(s),l=a[a.length-1]._key;La.get(l)===s&&La.delete(l)}else La.delete(s._key)})(r),t.__lexicalEditor=null):r&&V(198);let i=tD(t);for(let s=0;s<i.length;s++)i[s]();t.__lexicalEventHandles=[]}function iy(t,e,n){Yt();let o=t.__key,r=t.getParent();if(r===null)return;let i=(function(a){let l=ze();if(!fe(l)||!K(a))return l;let{anchor:c,focus:d}=l,u=c.getNode(),p=d.getNode();return Xp(u,a)&&c.set(a.__key,0,"element"),Xp(p,a)&&d.set(a.__key,0,"element"),l})(t),s=!1;if(fe(i)&&e){let a=i.anchor,l=i.focus;a.key===o&&(Wp(a,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0),l.key===o&&(Wp(l,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else of(i)&&e&&t.isSelected()&&t.selectPrevious();if(fe(i)&&e&&!s){let a=t.getIndexWithinParent();yi(t),Vp(i,r,a,-1)}else yi(t);n||Ro(r)||r.canBeEmpty()||!r.isEmpty()||iy(r,e),e&&i&&Fn(r)&&r.isEmpty()&&r.selectEnd()}function ZK(t){return t}var vi=class{static getType(){let{ownNodeType:e}=qy(this);return e===void 0&&V(64,this.name),e}static clone(e){V(65,this.name)}$config(){return{}}config(e,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:e}),{[e]:n}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),vD(this,e)}getType(){return this.__type}isInline(){V(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let n=$t(e);if(n===null)break;e=n.__parent}return!1}isSelected(e){let n=e||ze();if(n==null)return!1;let o=n.getNodes().some((r=>r.__key===this.__key));if(oe(this))return o;if(fe(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Xe(this)&&this.isInline()&&r){let i=n.isBackward()?n.focus:n.anchor;if(r.is(i.getNode())&&i.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let n=e.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:$t(e)}getParentOrThrow(){let e=this.getParent();return e===null&&V(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let n=e.getParent();if(Ro(n))return K(e)||e===this&&Xe(e)||V(194),e;e=n}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&V(67,this.__key),e}getParents(){let e=[],n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){let e=[],n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:$t(e)}getPreviousSiblings(){let e=[],n=this.getParent();if(n===null)return e;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)e.push(o),o=o.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:$t(e)}getNextSiblings(){let e=[],n=this.getNextSibling();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getCommonAncestor(e){let n=K(this)?this:this.getParent(),o=K(e)?e:e.getParent(),r=n&&o?Lc(n,o):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let n=Lc(this,e);return n!==null&&(n.type==="descendant"||(n.type==="branch"?ex(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&V(279),!1)))}isParentOf(e){let n=Lc(this,e);return n!==null&&n.type==="ancestor"}getNodesBetween(e){let n=this.isBefore(e),o=[],r=new Set,i=this;for(;i!==null;){let s=i.__key;if(r.has(s)||(r.add(s),o.push(i)),i===e)break;let a=K(i)?n?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}let l=n?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||o.push(c),c===e)break;let d=null,u=c;do{if(u===null&&V(68),d=n?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;d!==null||r.has(u.__key)||o.push(u)}while(d===null);i=d}return n||o.reverse(),o}isDirty(){let e=st()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=$t(this.__key);return e===null&&V(113),e}getWritable(){Yt();let e=Ur(),n=st(),o=e._nodeMap,r=this.__key,i=this.getLatest(),s=n._cloneNotNeeded,a=ze();if(a!==null&&a.setCachedNodes(null),s.has(r))return Jp(i),i;let l=BD(i);return s.add(r),Jp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){V(70)}updateDOM(e,n,o){V(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){V(18,this.name)}updateFromJSON(e){return(function(n,o){let r=n.getWritable(),i=o.$,s=i;for(let a of C1(r).flatKeys)a in o&&(s!==void 0&&s!==i||(s={...i}),s[a]=o[a]);return(r.__state||s)&&Ey(n).updateFromJSON(s),r})(this,e)}static transform(){return null}remove(e){iy(this,!0,e)}replace(e,n){Yt();let o=ze();o!==null&&(o=o.clone()),$b(this,e);let r=this.getLatest(),i=this.__key,s=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),c=l.__size;yi(a);let d=r.getPreviousSibling(),u=r.getNextSibling(),p=r.__prev,h=r.__next,g=r.__parent;if(iy(r,!1,!0),d===null?l.__first=s:d.getWritable().__next=s,a.__prev=p,u===null?l.__last=s:u.getWritable().__prev=s,a.__next=h,a.__parent=g,l.__size=c,n&&(K(this)&&K(a)||V(139),this.getChildren().forEach((m=>{a.append(m)}))),fe(o)){zn(o);let m=o.anchor,_=o.focus;m.key===i&&zN(m,a),_.key===i&&zN(_,a)}return _i()===i&&qt(s),a}insertAfter(e,n=!0){Yt(),$b(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=ze(),a=!1,l=!1;if(i!==null){let h=e.getIndexWithinParent();if(yi(r),fe(s)){let g=i.__key,m=s.anchor,_=s.focus;a=m.type==="element"&&m.key===g&&m.offset===h+1,l=_.type==="element"&&_.key===g&&_.offset===h+1}}let c=this.getNextSibling(),d=this.getParentOrThrow().getWritable(),u=r.__key,p=o.__next;if(c===null?d.__last=u:c.getWritable().__prev=u,d.__size++,o.__next=u,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&fe(s)){let h=this.getIndexWithinParent();Vp(s,d,h+1);let g=d.__key;a&&s.anchor.set(g,h+2,"element"),l&&s.focus.set(g,h+2,"element")}return e}insertBefore(e,n=!0){Yt(),$b(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.__key;yi(r);let s=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=o.__prev,c=this.getIndexWithinParent();s===null?a.__first=i:s.getWritable().__next=i,a.__size++,o.__prev=i,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let d=ze();return n&&fe(d)&&Vp(d,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return Br()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,n){Yt();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(K(o))return o.select();if(!oe(o)){let i=o.getIndexWithinParent()+1;return r.select(i,i)}return o.select(e,n)}selectNext(e,n){Yt();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(K(o))return o.select(0,0);if(!oe(o)){let i=o.getIndexWithinParent();return r.select(i,i)}return o.select(e,n)}markDirty(){this.getWritable()}reconcileObservedMutation(e,n){this.markDirty()}},Ba=class t extends vi{static getType(){return"linebreak"}static clone(e){return new t(e.__key)}constructor(e){super(e)}getTextContent(){return`
108
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(n){let o=n.parentElement;if(o!==null&&uy(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Sp(r)){let i=o.lastChild;if(i===n||i.previousSibling===n&&Sp(i))return!0}}return!1})(e)||(function(n){let o=n.parentElement;if(o!==null&&uy(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Sp(r))return!1;let i=o.lastChild;if(i===n||i.previousSibling===n&&Sp(i))return!0}return!1})(e)?null:{conversion:QK,priority:0}}}static importJSON(e){return $a().updateFromJSON(e)}};function QK(t){return{node:$a()}}function $a(){return Jc(new Ba)}function ys(t){return t instanceof Ba}function Sp(t){return rr(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Lb(t,e){return 16&e?"code":e&Qp?"mark":32&e?"sub":64&e?"sup":null}function Rb(t,e){return 1&e?"strong":2&e?"em":"span"}function oD(t,e,n,o,r){let i=o.classList,s=Ra(r,"base");s!==void 0&&i.add(...s),s=Ra(r,"underlineStrikethrough");let a=!1,l=e&Bc&&e&Fc;s!==void 0&&(n&Bc&&n&Fc?(a=!0,l||i.add(...s)):l&&i.remove(...s));for(let c in hn){let d=hn[c];if(s=Ra(r,c),s!==void 0)if(n&d){if(a&&(c==="underline"||c==="strikethrough")){e&d&&i.remove(...s);continue}e&d&&(!l||c!=="underline")&&c!=="strikethrough"||i.add(...s)}else e&d&&i.remove(...s)}}function rD(t,e,n){let o=e.firstChild,r=n.isComposing(),i=t+(r?ef:"");if(o==null)e.textContent=i;else{let s=o.nodeValue;if(s!==i)if(r||xs){let[a,l,c]=(function(d,u){let p=d.length,h=u.length,g=0,m=0;for(;g<p&&g<h&&d[g]===u[g];)g++;for(;m+g<p&&m+g<h&&d[p-m-1]===u[h-m-1];)m++;return[g,p-g-m,u.slice(g,h-m)]})(s,i);l!==0&&o.deleteData(a,l),o.insertData(a,c)}else o.nodeValue=i}}function FN(t,e,n,o,r,i){rD(r,t,e);let s=i.theme.text;s!==void 0&&oD(0,0,o,t,s)}function kp(t,e){let n=document.createElement(e);return n.appendChild(t),n}var Es=class t extends vi{static getType(){return"text"}static clone(e){return new t(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",n){super(n),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return kK[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===_i()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let n=hn[e];return!!(this.getFormat()&n)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,n){return qp(this.getLatest().__format,e,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,n){let o=this.__format,r=Lb(0,o),i=Rb(0,o),s=r===null?i:r,a=document.createElement(s),l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(i),a.appendChild(l)),FN(l,this,0,o,this.__text,e);let c=this.__style;return c!==""&&(a.style.cssText=c),a}updateDOM(e,n,o){let r=this.__text,i=e.__format,s=this.__format,a=Lb(0,i),l=Lb(0,s),c=Rb(0,i),d=Rb(0,s);if((a===null?c:a)!==(l===null?d:l))return!0;if(a===l&&c!==d){let m=n.firstChild;m==null&&V(48);let _=document.createElement(d);return FN(_,this,0,s,r,o),n.replaceChild(_,m),!1}let u=n;l!==null&&a!==null&&(u=n.firstChild,u==null&&V(49)),rD(r,u,this);let p=o.theme.text;p!==void 0&&i!==s&&oD(0,i,s,u,p);let h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:o3,priority:0}),b:()=>({conversion:t3,priority:0}),code:()=>({conversion:Ar,priority:0}),em:()=>({conversion:Ar,priority:0}),i:()=>({conversion:Ar,priority:0}),mark:()=>({conversion:Ar,priority:0}),s:()=>({conversion:Ar,priority:0}),span:()=>({conversion:e3,priority:0}),strong:()=>({conversion:Ar,priority:0}),sub:()=>({conversion:Ar,priority:0}),sup:()=>({conversion:Ar,priority:0}),u:()=>({conversion:Ar,priority:0})}}static importJSON(e){return Gt().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return kn(n)||V(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=kp(n,"b")),this.hasFormat("italic")&&(n=kp(n,"i")),this.hasFormat("strikethrough")&&(n=kp(n,"s")),this.hasFormat("underline")&&(n=kp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,n){}setFormat(e){let n=this.getWritable();return n.__format=typeof e=="string"?hn[e]:e,n}setDetail(e){let n=this.getWritable();return n.__detail=typeof e=="string"?wK[e]:e,n}setStyle(e){let n=this.getWritable();return n.__style=e,n}toggleFormat(e){let n=qp(this.getFormat(),e,null);return this.setFormat(n)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let n=SK[e];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(e){if(this.__text===e)return this;let n=this.getWritable();return n.__text=e,n}select(e,n){Yt();let o=e,r=n,i=ze(),s=this.getTextContent(),a=this.__key;if(typeof s=="string"){let l=s.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!fe(i))return aD(a,o,a,r,"text","text");{let l=_i();l!==i.anchor.key&&l!==i.focus.key||qt(a),i.setTextNodeRange(this,o,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,n,o,r){let i=this.getWritable(),s=i.__text,a=o.length,l=e;l<0&&(l=a+l,l<0&&(l=0));let c=ze();if(r&&fe(c)){let u=e+a;c.setTextNodeRange(i,u,i,u)}let d=s.slice(0,l)+o+s.slice(l+n);return i.__text=d,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Yt();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,i=_i(),s=o.length;e.sort(((T,w)=>T-w)),e.push(s);let a=[],l=e.length;for(let T=0,w=0;T<s&&w<=l;w++){let S=e[w];S>T&&(a.push(o.slice(T,S)),T=S)}let c=a.length;if(c===1)return[n];let d=a[0],u=n.getParent(),p,h=n.getFormat(),g=n.getStyle(),m=n.__detail,_=!1,b=null,y=null,v=ze();if(fe(v)){let[T,w]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];T.type==="text"&&T.key===r&&(b=T),w.type==="text"&&w.key===r&&(y=w)}n.isSegmented()?(p=Gt(d),p.__format=h,p.__style=g,p.__detail=m,p.__state=kN(n,p),_=!0):p=n.setTextContent(d);let x=[p];for(let T=1;T<c;T++){let w=Gt(a[T]);w.__format=h,w.__style=g,w.__detail=m,w.__state=kN(n,w);let S=w.__key;i===r&&qt(S),x.push(w)}let C=b?b.offset:null,E=y?y.offset:null,k=0;for(let T of x){if(!b&&!y)break;let w=k+T.getTextContentSize();if(b!==null&&C!==null&&C<=w&&C>=k&&(b.set(T.getKey(),C-k,"text"),C<w&&(b=null)),y!==null&&E!==null&&E<=w&&E>=k){y.set(T.getKey(),E-k,"text");break}k=w}if(u!==null){(function(S){let N=S.getPreviousSibling(),D=S.getNextSibling();N!==null&&Jp(N),D!==null&&Jp(D)})(this);let T=u.getWritable(),w=this.getIndexWithinParent();_?(T.splice(w,0,x),this.remove()):T.splice(w,1,x),fe(v)&&Vp(v,u,w,c-1)}return x}mergeWithSibling(e){let n=e===this.getPreviousSibling();n||e===this.getNextSibling()||V(50);let o=this.__key,r=e.__key,i=this.__text,s=i.length;_i()===r&&qt(o);let a=ze();if(fe(a)){let u=a.anchor,p=a.focus;u!==null&&u.key===r&&GN(u,n,o,e,s),p!==null&&p.key===r&&GN(p,n,o,e,s)}let l=e.__text,c=n?l+i:i+l;this.setTextContent(c);let d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function e3(t){return{forChild:Oy(t.style),node:null}}function t3(t){let e=t,n=e.style.fontWeight==="normal";return{forChild:Oy(e.style,n?void 0:"bold"),node:null}}var BN=new WeakMap;function n3(t){if(!kn(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function o3(t){let e=t;t.parentElement===null&&V(129);let n=e.textContent||"";if((function(o){let r,i=o.parentNode,s=[o];for(;i!==null&&(r=BN.get(i))===void 0&&!n3(i);)s.push(i),i=i.parentNode;let a=r===void 0?i:r;for(let l=0;l<s.length;l++)BN.set(s[l],a);return a})(e)!==null){let o=n.split(/(\r?\n|\t)/),r=[],i=o.length;for(let s=0;s<i;s++){let a=o[s];a===`
109
+ `||a===`\r
110
+ `?r.push($a()):a===" "?r.push(nf()):a!==""&&r.push(Gt(a))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=e,r=!0;for(;o!==null&&(o=$N(o,!1))!==null;){let i=o.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=e,r=!0;for(;o!==null&&(o=$N(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Gt(n)}}function $N(t,e){let n=t;for(;;){let o;for(;(o=e?n.nextSibling:n.previousSibling)===null;){let i=n.parentElement;if(i===null)return null;n=i}if(n=o,kn(n)){let i=n.style.display;if(i===""&&!FD(n)||i!==""&&!i.startsWith("inline"))return null}let r=n;for(;(r=e?n.firstChild:n.lastChild)!==null;)n=r;if(rr(n))return n;if(n.nodeName==="BR")return null}}var r3={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ar(t){let e=r3[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Oy(t.style,e),node:null}}function Gt(t=""){return Jc(new Es(t))}function oe(t){return t instanceof Es}function Oy(t,e){let n=t.fontWeight,o=t.textDecoration.split(" "),r=n==="700"||n==="bold",i=o.includes("line-through"),s=t.fontStyle==="italic",a=o.includes("underline"),l=t.verticalAlign;return c=>(oe(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),a&&!c.hasFormat("underline")&&c.toggleFormat("underline"),l!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),l!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}var za=class t extends Es{static getType(){return"tab"}static clone(e){return new t(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let n=super.createDOM(e),o=Ra(e.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(e){return nf().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&V(126),super.setTextContent(" ")}spliceText(e,n,o,r){return o===""&&n===0||o===" "&&n===1||V(286),this}setDetail(e){return e!==2&&V(127),this}setMode(e){return e!=="normal"&&V(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function nf(){return Jc(new za)}function Iy(t){return t instanceof za}var sy=class{constructor(e,n,o){this._selection=null,this.key=e,this.offset=n,this.type=o}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:Qy(Io(Ti(this,"next")),Io(Ti(e,"next")))<0}getNode(){let e=$t(this.key);return e===null&&V(20),e}set(e,n,o,r){let i=this._selection,s=this.key;r&&this.key===e&&this.offset===n&&this.type===o||(this.key=e,this.offset=n,this.type=o,Ja()||(_i()===s&&qt(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function Lo(t,e,n){return new sy(t,e,n)}function Pb(t,e){let n=e.__key,o=t.offset,r="element";if(oe(e)){r="text";let i=e.getTextContentSize();o>i&&(o=i)}else if(!K(e)){let i=e.getNextSibling();if(oe(i))n=i.__key,o=0,r="text";else{let s=e.getParent();s&&(n=s.__key,o=e.getIndexWithinParent()+1)}}t.set(n,o,r)}function zN(t,e){if(K(e)){let n=e.getLastDescendant();K(n)||oe(n)?Pb(t,n):Pb(t,e)}else Pb(t,e)}var jp=class t{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!of(e))return!1;let n=this._nodes,o=e._nodes;return n.size===o.size&&Array.from(n).every((r=>o.has(r)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new t(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let n=this.getNodes(),o=n.length,r=n[o-1],i;if(oe(r))i=r.select();else{let s=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=this._nodes,o=[];for(let r of n){let i=$t(r);i!==null&&o.push(i)}return Ja()||(this._cachedNodes=o),o}getTextContent(){let e=this.getNodes(),n="";for(let o=0;o<e.length;o++)n+=e[o].getTextContent();return n}deleteNodes(){let e=this.getNodes();if((ze()||Ns())===this&&e[0]){let n=Zt(e[0],"next");KD(wi(n,n))}for(let n of e)n.remove()}};function fe(t){return t instanceof ws}var ws=class t{constructor(e,n,o,r){this.anchor=e,this.focus=n,e._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!fe(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=(function(o){let r=[],[i,s]=o.getTextSlices();i&&r.push(i.caret.origin);let a=new Set,l=new Set;for(let c of o)if(Mo(c)){let{origin:d}=c;r.length===0?a.add(d):(l.add(d),r.push(d))}else{let{origin:d}=c;K(d)&&l.has(d)||r.push(d)}if(s&&r.push(s.caret.origin),Ss(o.focus)&&K(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let c=Hr(o.focus.origin,"previous");Mo(c)&&a.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=Ya(c))a.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!K(c)||l.has(c)||c.isEmpty()||a.has(c))break;r.pop()}if(r.length===0&&o.isCollapsed()){let c=Io(o.anchor),d=Io(o.anchor.getFlipped()),u=h=>$r(h)?h.origin:h.getNodeAtCaret(),p=u(c)||u(d)||(o.anchor.getNodeAtCaret()?c.origin:d.origin);r.push(p)}return r})(tx(gy(this),"next"));return Ja()||(this._cachedNodes=n),n}setTextNodeRange(e,n,o,r){this.anchor.set(e.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let n=e[0],o=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[a,l]=ay(this),c="",d=!0;for(let u=0;u<e.length;u++){let p=e[u];if(K(p)&&!p.isInline())d||(c+=`
111
+ `),d=!p.isEmpty();else if(d=!1,oe(p)){let h=p.getTextContent();p===n?p===o?r.type==="element"&&i.type==="element"&&i.offset!==r.offset||(h=a<l?h.slice(a,l):h.slice(l,a)):h=s?h.slice(a):h.slice(l):p===o&&(h=s?h.slice(0,l):h.slice(0,a)),c+=h}else!Xe(p)&&!ys(p)||p===o&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(e){let n=st(),o=n.getEditorState()._selection,r=sD(e.startContainer,e.startOffset,e.endContainer,e.endOffset,n,o);if(r===null)return;let[i,s]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),Bp(this)}clone(){let e=this.anchor,n=this.focus;return new t(Lo(e.key,e.offset,e.type),Lo(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=qp(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let n=hn[e];return!!(this.format&n)}insertRawText(e){let n=e.split(/(\r?\n|\t)/),o=[],r=n.length;for(let i=0;i<r;i++){let s=n[i];s===`
112
+ `||s===`\r
113
+ `?o.push($a()):s===" "?o.push(nf()):o.push(Gt(s))}this.insertNodes(o)}insertText(e){let n=this.anchor,o=this.focus,r=this.format,i=this.style,s=n,a=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,a=n),s.type==="element"&&(function(_,b,y,v){let x=_.getNode(),C=x.getChildAtIndex(_.offset),E=Gt(),k=Fn(x)?Br().append(E):E;E.setFormat(y),E.setStyle(v),C===null?x.append(k):C.insertBefore(k),_.is(b)&&b.set(E.__key,0,"text"),_.set(E.__key,0,"text")})(s,a,r,i),a.type==="element"&&qa(a,Io(Ti(a,"next")));let l=s.offset,c=a.offset,d=this.getNodes(),u=d.length,p=d[0];oe(p)||V(26);let h=p.getTextContent().length,g=p.getParentOrThrow(),m=d[u-1];if(u===1&&a.type==="element"&&(c=h,a.set(s.key,c,"text")),this.isCollapsed()&&l===h&&(Lr(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let _=p.getNextSibling();if(oe(_)&&_.canInsertTextBefore()&&!Lr(_)||(_=Gt(),_.setFormat(r),_.setStyle(i),g.canInsertTextAfter()?p.insertAfter(_):g.insertAfter(_)),_.select(0,0),p=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(Lr(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let _=p.getPreviousSibling();if(oe(_)&&!Lr(_)||(_=Gt(),_.setFormat(r),g.canInsertTextBefore()?p.insertBefore(_):g.insertBefore(_)),_.select(),p=_,e!=="")return void this.insertText(e)}else if(p.isSegmented()&&l!==h){let _=Gt(p.getTextContent());_.setFormat(r),p.replace(_),p=_}else if(!this.isCollapsed()&&e!==""){let _=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||K(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),iD(this.anchor,this.focus,null),void this.insertText(e)}if(u===1){if(bi(p)){let v=Gt(e);return v.select(),void p.replace(v)}let _=p.getFormat(),b=p.getStyle();if(l!==c||_===r&&b===i){if(Iy(p)){let v=Gt(e);return v.setFormat(r),v.setStyle(i),v.select(),void p.replace(v)}}else{if(p.getTextContent()!==""){let v=Gt(e);if(v.setFormat(r),v.setStyle(i),v.select(),l===0)p.insertBefore(v,!1);else{let[x]=p.splitText(l);x.insertAfter(v,!1)}return void(v.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}p.setFormat(r),p.setStyle(i)}let y=c-l;p=p.spliceText(l,y,e,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(p.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=b))}else{let _=new Set([...p.getParentKeys(),...m.getParentKeys()]),b=K(p)?p:p.getParentOrThrow(),y=K(m)?m:m.getParentOrThrow(),v=m;if(!b.is(y)&&y.isInline())do v=y,y=y.getParentOrThrow();while(y.isInline());if(a.type==="text"&&(c!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<c)if(oe(m)&&!bi(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let T=Gt(m.getTextContent());m.replace(T),m=T}Fn(a.getNode())||a.type!=="text"||(m=m.spliceText(0,c,"")),_.add(m.__key)}else{let T=m.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?m.remove():T.remove()}else _.add(m.__key);let x=y.getChildren(),C=new Set(d),E=b.is(y),k=b.isInline()&&p.getNextSibling()===null?b:p;for(let T=x.length-1;T>=0;T--){let w=x[T];if(w.is(p)||K(w)&&w.isParentOf(p))break;w.isAttached()&&(!C.has(w)||w.is(v)?E||k.insertAfter(w,!1):w.remove())}if(!E){let T=y,w=null;for(;T!==null;){let S=T.getChildren(),N=S.length;(N===0||S[N-1].is(w))&&(_.delete(T.__key),w=T),T=T.getParent()}}if(bi(p))if(l===h)p.select();else{let T=Gt(e);T.select(),p.replace(T)}else p=p.spliceText(l,h-l,e,!0),p.getTextContent()===""?p.remove():p.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let T=1;T<u;T++){let w=d[T],S=w.__key;_.has(S)||w.remove()}}}removeText(){let e=ze()===this;Rc(this,jD(gy(this))),e&&ze()!==this&&zn(this)}formatText(e,n=null){if(this.isCollapsed())return this.toggleFormat(e),void qt(null);let o=this.getNodes(),r=[];for(let x of o)oe(x)&&r.push(x);let i=x=>{o.forEach((C=>{if(K(C)){let E=C.getFormatFlags(e,x);C.setTextFormat(E)}}))},s=r.length;if(s===0)return this.toggleFormat(e),qt(null),void i(n);let a=this.anchor,l=this.focus,c=this.isBackward(),d=c?l:a,u=c?a:l,p=0,h=r[0],g=d.type==="element"?0:d.offset;if(d.type==="text"&&g===h.getTextContentSize()&&(p=1,h=r[1],g=0),h==null)return;let m=h.getFormatFlags(e,n);i(m);let _=s-1,b=r[_],y=u.type==="text"?u.offset:b.getTextContentSize();if(h.is(b)){if(g===y)return;if(Lr(h)||g===0&&y===h.getTextContentSize())h.setFormat(m);else{let x=h.splitText(g,y),C=g===0?x[0]:x[1];C.setFormat(m),d.type==="text"&&d.set(C.__key,0,"text"),u.type==="text"&&u.set(C.__key,y-g,"text")}return void(this.format=m)}g===0||Lr(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);let v=b.getFormatFlags(e,m);y>0&&(y===b.getTextContentSize()||Lr(b)||([b]=b.splitText(y)),b.setFormat(v));for(let x=p+1;x<_;x++){let C=r[x],E=C.getFormatFlags(e,v);C.setFormat(E)}d.type==="text"&&d.set(h.__key,g,"text"),u.type==="text"&&u.set(b.__key,y,"text"),this.format=m|v}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=ze();return fe(g)||V(134),g.insertNodes(e)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Hb(n,Fr),r=e[e.length-1];if(K(o)&&"__language"in o){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let g=Fb(this);o.splice(g,0,e),r.selectEnd()}return}if(!e.some((g=>(K(g)||Xe(g))&&!g.isInline()))){K(o)||V(211,n.constructor.name,n.getType());let g=Fb(this);return o.splice(g,0,e),void r.selectEnd()}let i=(function(g){let m=Br(),_=null;for(let b=0;b<g.length;b++){let y=g[b],v=ys(y);if(v||Xe(y)&&y.isInline()||K(y)&&y.isInline()||oe(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),m.append(_),v))continue;_!==null&&_.append(y)}else m.append(y),_=null}return m})(e),s=i.getLastDescendant(),a=i.getChildren(),l=!K(o)||!o.isEmpty()?this.insertParagraph():null,c=a[a.length-1],d=a[0];var u;K(u=d)&&Fr(u)&&!u.isEmpty()&&K(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(K(o)||V(211,n.constructor.name,n.getType()),o.append(...d.getChildren()),d=a[1]),d&&(o===null&&V(212,n.constructor.name,n.getType()),(function(g,m,_){let b=m.getParentOrThrow().getLastChild(),y=m,v=[m];for(;y!==b;)y.getNextSibling()||V(140),y=y.getNextSibling(),v.push(y);let x=g;for(let C of v)x=x.insertAfter(C)})(o,d));let p=Hb(s,Fr);l&&K(p)&&(l.canMergeWhenEmpty()||Fr(c))&&(p.append(...l.getChildren()),l.remove()),K(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let h=K(o)?o.getLastChild():null;ys(h)&&p!==o&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Br();return $n().splice(this.anchor.offset,0,[s]),s.select(),s}let e=Fb(this),n=Hb(this.anchor.getNode(),Fr);K(n)||V(213);let o=n.getChildAtIndex(e),r=o?[o,...o.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let n=$a();if(this.insertNodes([n]),e){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let e=this.getNodes(),n=e.length,o=n-1,r=this.anchor,i=this.focus,s=e[0],a=e[o],[l,c]=ay(this);if(n===0)return[];if(n===1){if(oe(s)&&!this.isCollapsed()){let u=l>c?c:l,p=l>c?l:c,h=s.splitText(u,p),g=u===0?h[0]:h[1];return g!=null?[g]:[]}return[s]}let d=r.isBefore(i);if(oe(s)){let u=d?l:c;u===s.getTextContentSize()?e.shift():u!==0&&([,s]=s.splitText(u),e[0]=s)}if(oe(a)){let u=a.getTextContent().length,p=d?c:l;p===0?e.pop():p!==u&&([a]=a.splitText(p),e[o]=a)}return e}modify(e,n,o){if(YN(this,e,n,o))return;let r=e==="move",i=st(),s=or(Co(i));if(!s)return;let a=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(l===null||a===null||!K(c)||c.isInline()||c.canBeEmpty()||dy(a,i,l),this.dirty){let d=ja(i,this.anchor.key),u=ja(i,this.focus.key);this.anchor.type==="text"&&(d=Ts(d)),this.focus.type==="text"&&(u=Ts(u)),d&&u&&cD(s,d,this.anchor.offset,u,this.focus.offset)}if((function(d,u,p,h){d.modify(u,p,h)})(s,e,n?"backward":"forward",o),s.rangeCount>0){let d=s.getRangeAt(0),u=this.anchor.getNode(),p=Fn(u)?u:MD(u);if(this.applyDOMRange(d),this.dirty=!0,!r){let h=this.getNodes(),g=[],m=!1;for(let _=0;_<h.length;_++){let b=h[_];Xp(b,p)?g.push(b):m=!0}if(m&&g.length>0)if(n){let _=g[0];K(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{let _=g[g.length-1];K(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}s.anchorNode===d.startContainer&&s.anchorOffset===d.startOffset||(function(_){let b=_.focus,y=_.anchor,v=y.key,x=y.offset,C=y.type;y.set(b.key,b.offset,b.type,!0),b.set(v,x,C,!0)})(this)}}o==="lineboundary"&&YN(this,e,n,o,"decorators")}forwardDeletion(e,n,o){if(!o&&(e.type==="element"&&K(n)&&e.offset===n.getChildrenSize()||e.type==="text"&&e.offset===n.getTextContentSize())){let r=n.getParent(),i=n.getNextSibling()||(r===null?null:r.getNextSibling());if(K(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,e))return;let i=Xy(Ti(o,e?"previous":"next"));if(i.getTextSlices().every((a=>a===null||a.distance===0))){let a={type:"initial"};for(let l of i.iterNodeCarets("shadowRoot"))if(Mo(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(a.type==="merge-block")break;if(K(i.anchor.origin)&&i.anchor.origin.isEmpty()){let c=Io(l);Rc(this,wi(c,c)),i.anchor.origin.remove()}return}a.type!=="merge-next-block"&&a.type!=="merge-block"||(a={block:a.block,caret:l,type:"merge-block"})}}else{if(a.type==="merge-block")break;if(Ss(l)){if(K(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(i.anchor.origin))break}else a={block:l.origin,type:"merge-next-block"};continue}if(Xe(l.origin)){if(!l.origin.isIsolated())if(a.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&K(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let c=Ay();c.add(l.origin.getKey()),zn(c)}else l.origin.remove();return}break}}if(a.type==="merge-block"){let{caret:l,block:c}=a;return Rc(this,wi(!l.origin.isEmpty()&&c.isEmpty()?Za(Zt(c,l.direction)):i.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&o.offset===0&&UN(this,o.getNode()))return}else{let a=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,a!==null&&a.isSegmented()){let l=s.offset,c=a.getTextContentSize();if(a.is(r)||e&&l!==c||!e&&l!==0)return void KN(a,e,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,c=r.getTextContentSize();if(r.is(a)||e&&l!==0||!e&&l!==c)return void KN(r,e,l)}(function(l,c){let d=l.anchor,u=l.focus,p=d.getNode(),h=u.getNode();if(p===h&&d.type==="text"&&u.type==="text"){let g=d.offset,m=u.offset,_=g<m,b=_?g:m,y=_?m:g,v=y-1;b!==v&&(function(x){return!(TD(x)||i3(x))})(p.getTextContent().slice(b,y))&&(c?u.set(u.key,v,u.type):d.set(d.key,v,d.type))}})(this,e)}}if(this.removeText(),e&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&Fn(o.getParent())&&o.getPreviousSibling()===null&&UN(this,o)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function of(t){return t instanceof jp}function HN(t){let e=t.offset;if(t.type==="text")return e;let n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function ay(t){let e=t.getStartEndPoints();if(e===null)return[0,0];let[n,o]=e;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[HN(n),HN(o)]}function UN(t,e){for(let n=e;n;n=n.getParent()){if(K(n)){if(n.collapseAtStart(t))return!0;if(Ro(n))break}if(n.getPreviousSibling())break}return!1}var i3=(()=>{try{let t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\uFE0F")&&e("#\uFE0F\u20E3")&&e("\u{1F44D}"))return e}catch{}return()=>!1})();function KN(t,e,n){let o=t,r=o.getTextContent().split(/(?=\s)/g),i=r.length,s=0,a=0;for(let c=0;c<i;c++){let d=c===i-1;if(a=s,s+=r[c].length,e&&s===n||s>n||d){r.splice(c,1),d&&(a=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(a,a))}function jN(t,e,n,o){let r,i=e;if(kn(t)){let s=!1,a=t.childNodes,l=a.length,c=o._blockCursorElement;i===l&&(s=!0,i=l-1);let d=a[i],u=!1;if(d===c)d=a[i+1],u=!0;else if(c!==null){let p=c.parentNode;t===p&&e>Array.prototype.indexOf.call(p.children,c)&&i--}if(r=Aa(d),oe(r))i=r1(r,s);else{let p=Aa(t);if(p===null)return null;if(K(p)){let h=o.getElementByKey(p.getKey());h===null&&V(214),[p,i]=p.getDOMSlot(h).resolveChildIndex(p,h,t,e),K(p)||V(215),s&&i>=p.getChildrenSize()&&(i=Math.max(0,p.getChildrenSize()-1));let m=p.getChildAtIndex(i);if(K(m)&&(function(_,b,y){let v=_.getParent();return y===null||v===null||!v.canBeEmpty()||v!==y.getNode()})(m,0,n)){let _=s?m.getLastDescendant():m.getFirstDescendant();_===null?p=m:(m=_,p=K(m)?m:m.getParentOrThrow()),i=0}oe(m)?(r=m,p=null,i=r1(m,s)):m!==p&&s&&!u&&(K(p)||V(216),i=Math.min(p.getChildrenSize(),i+1))}else{let h=p.getIndexWithinParent();i=e===0&&Xe(p)&&Aa(t)===p?h:h+1,p=p.getParentOrThrow()}if(K(p))return Lo(p.__key,i,"element")}}else r=Aa(t);return oe(r)?Lo(r.__key,i,"text"):null}function VN(t,e,n){let o=t.offset,r=t.getNode();if(o===0){let i=r.getPreviousSibling(),s=r.getParent();if(e){if((n||!e)&&i===null&&K(s)&&s.isInline()){let a=s.getPreviousSibling();oe(a)&&t.set(a.__key,a.getTextContent().length,"text")}}else K(i)&&!n&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):oe(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(o===r.getTextContent().length){let i=r.getNextSibling(),s=r.getParent();if(e&&K(i)&&i.isInline())t.set(i.__key,0,"element");else if((n||e)&&i===null&&K(s)&&s.isInline()&&!s.canInsertTextAfter()){let a=s.getNextSibling();oe(a)&&t.set(a.__key,0,"text")}}}function iD(t,e,n){if(t.type==="text"&&e.type==="text"){let o=t.isBefore(e),r=t.is(e);VN(t,o,r),VN(e,!o,r),r&&e.set(t.key,t.offset,t.type);let i=st();if(i.isComposing()&&i._compositionKey!==t.key&&fe(n)){let s=n.anchor,a=n.focus;t.set(s.key,s.offset,s.type,!0),e.set(a.key,a.offset,a.type,!0)}}}function sD(t,e,n,o,r,i){if(t===null||n===null||!Gc(r,t,n))return null;let s=jN(t,e,fe(i)?i.anchor:null,r);if(s===null)return null;let a=jN(n,o,fe(i)?i.focus:null,r);if(a===null)return null;if(s.type==="element"&&a.type==="element"){let l=Aa(t),c=Aa(n);if(Xe(l)&&Xe(c))return null}return iD(s,a,i),[s,a]}function s3(t){return K(t)&&!t.isInline()}function aD(t,e,n,o,r,i){let s=Ur(),a=new ws(Lo(t,e,r),Lo(n,o,i),0,"");return a.dirty=!0,s._selection=a,a}function lD(){let t=Lo("root",0,"element"),e=Lo("root",0,"element");return new ws(t,e,0,"")}function Ay(){return new jp(new Set)}function a3(t,e){return rf(null,t,e,null)}function rf(t,e,n,o){let r=n._window;if(r===null)return null;let i=o||r.event,s=i?i.type:void 0,a=s==="selectionchange",l=!Kb&&(a||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0),c,d,u,p;if(fe(t)&&!l)return t.clone();if(e===null)return null;if(c=e.anchorNode,d=e.focusNode,u=e.anchorOffset,p=e.focusOffset,a&&fe(t)&&!Gc(n,c,d))return t.clone();let h=sD(c,u,d,p,n,t);if(h===null)return null;let[g,m]=h;return new ws(g,m,fe(t)?t.format:0,fe(t)?t.style:"")}function ze(){return Ur()._selection}function Ns(){return st()._editorState._selection}function Vp(t,e,n,o=1){let r=t.anchor,i=t.focus,s=r.getNode(),a=i.getNode();if(!e.is(s)&&!e.is(a))return;let l=e.__key;if(t.isCollapsed()){let c=r.offset;if(n<=c&&o>0||n<c&&o<0){let d=Math.max(0,c+o);r.set(l,d,"element"),i.set(l,d,"element"),WN(t)}}else{let c=t.isBackward(),d=c?i:r,u=d.getNode(),p=c?r:i,h=p.getNode();if(e.is(u)){let g=d.offset;(n<=g&&o>0||n<g&&o<0)&&d.set(l,Math.max(0,g+o),"element")}if(e.is(h)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}WN(t)}function WN(t){let e=t.anchor,n=e.offset,o=t.focus,r=o.offset,i=e.getNode(),s=o.getNode();if(t.isCollapsed()){if(!K(i))return;let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(oe(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text"),o.set(c.__key,d,"text")}}else{if(K(i)){let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(oe(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text")}}if(K(s)){let a=s.getChildrenSize(),l=r>=a,c=l?s.getChildAtIndex(a-1):s.getChildAtIndex(r);if(oe(c)){let d=0;l&&(d=c.getTextContentSize()),o.set(c.__key,d,"text")}}}}function Wp(t,e,n,o,r){let i=null,s=0,a=null;o!==null?(i=o.__key,oe(o)?(s=o.getTextContentSize(),a="text"):K(o)&&(s=o.getChildrenSize(),a="element")):r!==null&&(i=r.__key,oe(r)?a="text":K(r)&&(a="element")),i!==null&&a!==null?t.set(i,s,a):(s=e.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function GN(t,e,n,o,r){t.type==="text"?t.set(n,t.offset+(e?0:r),"text"):t.offset>o.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function cD(t,e,n,o,r){try{t.setBaseAndExtent(e,n,o,r)}catch{}}function l3(t,e,n,o,r,i,s){let a=o.anchorNode,l=o.focusNode,c=o.anchorOffset,d=o.focusOffset,u=document.activeElement;if(r.has(gD)&&u!==i||u!==null&&$y(u))return;if(!fe(e))return void(t!==null&&Gc(n,a,l)&&o.removeAllRanges());let p=e.anchor,h=e.focus,g=p.key,m=h.key,_=ja(n,g),b=ja(n,m),y=p.offset,v=h.offset,x=e.format,C=e.style,E=e.isCollapsed(),k=_,T=b,w=!1;if(p.type==="text"){k=Ts(_);let I=p.getNode();w=I.getFormat()!==x||I.getStyle()!==C}else fe(t)&&t.anchor.type==="text"&&(w=!0);var S,N,D,O,A;if(h.type==="text"&&(T=Ts(b)),k!==null&&T!==null&&(E&&(t===null||w||fe(t)&&(t.format!==x||t.style!==C))&&(S=x,N=C,D=y,O=g,A=performance.now(),X1=[S,N,D,O,A]),c!==y||d!==v||a!==k||l!==T||o.type==="Range"&&E||(u!==null&&i.contains(u)||i.focus({preventScroll:!0}),p.type==="element"))){if(cD(o,k,y,T,v),!r.has(mD)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let I=fe(e)&&e.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(I!==null){let R;if(I instanceof Text){let $=document.createRange();$.selectNode(I),R=$.getBoundingClientRect()}else R=I.getBoundingClientRect();(function($,W,P){let q=Vy(P),ce=Wy(q);if(q===null||ce===null)return;let{top:rt,bottom:Et}=W,_t=0,dt=0,ut=P;for(;ut!==null;){let re=ut===q.body;if(re)_t=0,dt=Co($).innerHeight;else{let be=ut.getBoundingClientRect();_t=be.top,dt=be.bottom}let ee=0;if(rt<_t?ee=-(_t-rt):Et>dt&&(ee=Et-dt),ee!==0)if(re)ce.scrollBy(0,ee);else{let be=ut.scrollTop;ut.scrollTop+=ee;let Fe=ut.scrollTop-be;rt-=Fe,Et-=Fe}if(re)break;ut=qc(ut)}})(n,R,i)}}oy=!0}}function c3(t){let e=ze()||Ns();e===null&&(e=$n().selectEnd()),e.insertNodes(t)}function d3(){let t=ze();return t===null?"":t.getTextContent()}function Fb(t){let e=t;t.isCollapsed()||e.removeText();let n=ze();fe(n)&&(e=n),fe(e)||V(161);let o=e.anchor,r=o.getNode(),i=o.offset;for(;!Fr(r);){let s=r;if([r,i]=u3(r,i),s.is(r))break}return i}function u3(t,e){let n=t.getParent();if(!n){let r=Br();return $n().append(r),r.select(),[$n(),0]}if(oe(t)){let r=t.splitText(e);if(r.length===0)return[n,t.getIndexWithinParent()];let i=e===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!K(t)||e===0)return[n,t.getIndexWithinParent()];let o=t.getChildAtIndex(e);if(o){let r=new ws(Lo(t.__key,e,"element"),Lo(t.__key,e,"element"),0,""),i=t.insertNewAfter(r);i&&i.append(o,...o.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function YN(t,e,n,o,r="decorators-and-blocks"){if(e==="move"&&o==="character"&&!t.isCollapsed()){let[d,u]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return u.set(d.key,d.offset,d.type),!0}let i=Ti(t.focus,n?"previous":"next"),s=o==="lineboundary",a=e==="move",l=i,c=r==="decorators-and-blocks";if(!VD(l)){for(let d of l){c=!1;let{origin:u}=d;if(!Xe(u)||u.isIsolated()||(l=d,!s||!u.isInline()))break}if(c)for(let d of Xy(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(Mo(d))d.origin.isInline()||(l=d);else{if(K(d.origin))continue;Xe(d.origin)&&!d.origin.isInline()&&(l=d)}break}}if(l===i)return!1;if(a&&!s&&Xe(l.origin)&&l.origin.isKeyboardSelectable()){let d=Ay();return d.add(l.origin.getKey()),zn(d),!0}return l=Io(l),a&&qa(t.anchor,l),qa(t.focus,l),c||!s}var Jt=null,Xt=null,Bn=!1,Bb=!1,Ap=0,qN={characterData:!0,childList:!0,subtree:!0};function Ja(){return Bn||Jt!==null&&Jt._readOnly}function Yt(){Bn&&V(13)}function dD(){Ap>99&&V(14)}function Ur(){return Jt===null&&V(195,uD()),Jt}function st(){return Xt===null&&V(196,uD()),Xt}function uD(){let t=0,e=new Set,n=Ka.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let i=Yc(r);if(sf(i))t++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let o=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(o+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),o}function p3(){return Xt}function JN(t,e,n){let o=e.__type,r=Fy(t,o),i=n.get(o);i===void 0&&(i=Array.from(r.transforms),n.set(o,i));let s=i.length;for(let a=0;a<s&&(i[a](e),e.isAttached());a++);}function XN(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function pD(t,e){if(!e)return;let n=t._updateTags,o=e;Array.isArray(e)||(o=[e]);for(let r of o)n.add(r)}function f3(t){return My(t,st()._nodes)}function My(t,e){let n=t.type,o=e.get(n);o===void 0&&V(17,n);let r=o.klass;t.type!==r.getType()&&V(18,r.name);let i=r.importJSON(t),s=t.children;if(K(i)&&Array.isArray(s))for(let a=0;a<s.length;a++){let l=My(s[a],e);i.append(l)}return i}function ZN(t,e,n){let o=Jt,r=Bn,i=Xt;Jt=e,Bn=!0,Xt=t;try{return n()}finally{Jt=o,Bn=r,Xt=i}}function Pr(t,e){let n=t._pendingEditorState,o=t._rootElement,r=t._headless||o===null;if(n===null)return;let i=t._editorState,s=i._selection,a=n._selection,l=t._dirtyType!==vs,c=Jt,d=Bn,u=Xt,p=t._updating,h=t._observer,g=null;if(t._pendingEditorState=null,t._editorState=n,!r&&l&&h!==null){Xt=t,Jt=n,Bn=!1,t._updating=!0;try{let E=t._dirtyType,k=t._dirtyElements,T=t._dirtyLeaves;h.disconnect(),g=zK(i,n,t,E,k,T)}catch(E){if(E instanceof Error&&t._onError(E),Bb)throw E;return bD(t,null,o,n),x1(t),t._dirtyType=Fa,Bb=!0,Pr(t,i),void(Bb=!1)}finally{h.observe(o,qN),t._updating=p,Jt=c,Bn=d,Xt=u}}n._readOnly||(n._readOnly=!0);let m=t._dirtyLeaves,_=t._dirtyElements,b=t._normalizedNodes,y=t._updateTags,v=t._deferred;l&&(t._dirtyType=vs,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),(function(E,k){let T=E._decorators,w=E._pendingDecorators||T,S=k._nodeMap,N;for(N in w)S.has(N)||(w===T&&(w=ED(E)),delete w[N])})(t,n);let x=r?null:or(Co(t));if(t._editable&&x!==null&&(l||a===null||a.dirty)&&o!==null&&!y.has(_D)){Xt=t,Jt=n;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){let E=t._blockCursorElement;E!==null&&dy(E,t,o),l3(s,a,t,x,y,o)}(function(E,k,T){let w=E._blockCursorElement;if(fe(T)&&T.isCollapsed()&&T.anchor.type==="element"&&k.contains(document.activeElement)){let S=T.anchor,N=S.getNode(),D=S.offset,O=!1,A=null;if(D===N.getChildrenSize())zb(N.getChildAtIndex(D-1))&&(O=!0);else{let I=N.getChildAtIndex(D);if(I!==null&&zb(I)){let R=I.getPreviousSibling();(R===null||zb(R))&&(O=!0,A=E.getElementByKey(I.__key))}}if(O){let I=E.getElementByKey(N.__key);return w===null&&(E._blockCursorElement=w=(function(R){let $=R.theme,W=document.createElement("div");W.contentEditable="false",W.setAttribute("data-lexical-cursor","true");let P=$.blockCursor;if(P!==void 0){if(typeof P=="string"){let q=Pp(P);P=$.blockCursor=q}P!==void 0&&W.classList.add(...P)}return W})(E._config)),k.style.caretColor="transparent",void(A===null?I.appendChild(w):I.insertBefore(w,A))}}w!==null&&dy(w,E,k)})(t,o,a)}finally{h!==null&&h.observe(o,qN),Xt=u,Jt=c}}g!==null&&(function(E,k,T,w,S){let N=Array.from(E._listeners.mutation),D=N.length;for(let O=0;O<D;O++){let[A,I]=N[O];for(let R of I){let $=k.get(R);$!==void 0&&A($,{dirtyLeaves:w,prevEditorState:S,updateTags:T})}}})(t,g,y,m,i),fe(a)||a===null||s!==null&&s.is(a)||t.dispatchCommand(wy,void 0);let C=t._pendingDecorators;C!==null&&(t._decorators=C,t._pendingDecorators=null,Mc("decorator",t,!0,C)),(function(E,k,T){let w=o1(k),S=o1(T);w!==S&&Mc("textcontent",E,!0,S)})(t,e||i,n),Mc("update",t,!0,{dirtyElements:_,dirtyLeaves:m,editorState:n,mutatedNodes:g,normalizedNodes:b,prevEditorState:e||i,tags:y}),(function(E,k){if(E._deferred=[],k.length!==0){let T=E._updating;E._updating=!0;try{for(let w=0;w<k.length;w++)k[w]()}finally{E._updating=T}}})(t,v),(function(E){let k=E._updates;if(k.length!==0){let T=k.shift();if(T){let[w,S]=T;Ly(E,w,S)}}})(t)}function Mc(t,e,n,...o){let r=e._updating;e._updating=n;try{let i=Array.from(e._listeners[t]);for(let s=0;s<i.length;s++)i[s].apply(null,o)}finally{e._updating=r}}function QN(t,e){let n=t._updates,o=e||!1;for(;n.length!==0;){let r=n.shift();if(r){let[i,s]=r,a;if(s!==void 0){if(a=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete){let l=t._pendingEditorState;l===null&&V(191),l._flushSync=!0}a&&t._deferred.push(a),pD(t,s.tag)}i()}}return o}function Ly(t,e,n){let o=t._updateTags,r,i=!1,s=!1;n!==void 0&&(r=n.onUpdate,pD(t,n.tag),i=n.skipTransforms||!1,s=n.discrete||!1),r&&t._deferred.push(r);let a=t._editorState,l=t._pendingEditorState,c=!1;(l===null||l._readOnly)&&(l=t._pendingEditorState=fD(l||a),c=!0),l._flushSync=s;let d=Jt,u=Bn,p=Xt,h=t._updating;Jt=l,Bn=!1,t._updating=!0,Xt=t;let g=t._headless||t.getRootElement()===null;Py(null);try{c&&(g?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=(function(y,v){let x=y.getEditorState()._selection,C=or(Co(y));return fe(x)||x==null?rf(x,C,y,v):x.clone()})(t,n&&n.event||null));let _=t._compositionKey;e(),i=QN(t,i),(function(y,v){let x=v.getEditorState()._selection,C=y._selection;if(fe(C)){let E=C.anchor,k=C.focus,T;if(E.type==="text"&&(T=E.getNode(),T.selectionTransform(x,C)),k.type==="text"){let w=k.getNode();T!==w&&w.selectionTransform(x,C)}}})(l,t),t._dirtyType!==vs&&(i?(function(y,v){let x=v._dirtyLeaves,C=y._nodeMap;for(let E of x){let k=C.get(E);oe(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&ON(k)}})(l,t):(function(y,v){let x=v._dirtyLeaves,C=v._dirtyElements,E=y._nodeMap,k=_i(),T=new Map,w=x,S=w.size,N=C,D=N.size;for(;S>0||D>0;){if(S>0){v._dirtyLeaves=new Set;for(let O of w){let A=E.get(O);oe(A)&&A.isAttached()&&A.isSimpleText()&&!A.isUnmergeable()&&ON(A),A!==void 0&&XN(A,k)&&JN(v,A,T),x.add(O)}if(w=v._dirtyLeaves,S=w.size,S>0){Ap++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map,N.delete("root")&&N.set("root",!0);for(let O of N){let A=O[0],I=O[1];if(C.set(A,I),!I)continue;let R=E.get(A);R!==void 0&&XN(R,k)&&JN(v,R,T)}w=v._dirtyLeaves,S=w.size,N=v._dirtyElements,D=N.size,Ap++}v._dirtyLeaves=x,v._dirtyElements=C})(l,t),QN(t),(function(y,v,x,C){let E=y._nodeMap,k=v._nodeMap,T=[];for(let[w]of C){let S=k.get(w);S!==void 0&&(S.isAttached()||(K(S)&&_1(S,w,E,k,T,C),E.has(w)||C.delete(w),T.push(w)))}for(let w of T)k.delete(w);for(let w of x){let S=k.get(w);S===void 0||S.isAttached()||(E.has(w)||x.delete(w),k.delete(w))}})(a,l,t._dirtyLeaves,t._dirtyElements)),_!==t._compositionKey&&(l._flushSync=!0);let b=l._selection;if(fe(b)){let y=l._nodeMap,v=b.anchor.key,x=b.focus.key;y.get(v)!==void 0&&y.get(x)!==void 0||V(19)}else of(b)&&b._nodes.size===0&&(l._selection=null)}catch(_){return _ instanceof Error&&t._onError(_),t._pendingEditorState=a,t._dirtyType=Fa,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void Pr(t)}finally{Jt=d,Bn=u,Xt=p,t._updating=h,Ap=0}t._dirtyType!==vs||t._deferred.length>0||(function(_,b){let y=b.getEditorState()._selection,v=_._selection;if(v!==null){if(v.dirty||!v.is(y))return!0}else if(y!==null)return!0;return!1})(l,t)?l._flushSync?(l._flushSync=!1,Pr(t)):c&&k3((()=>{Pr(t)})):(l._flushSync=!1,c&&(o.clear(),t._deferred=[],t._pendingEditorState=null))}function ro(t,e,n){Xt===t&&n===void 0?e():Ly(t,e,n)}var ly=class t{constructor(e,n,o){this.element=e,this.before=n||null,this.after=o||null}withBefore(e){return new t(this.element,e,this.after)}withAfter(e){return new t(this.element,this.before,e)}withElement(e){return this.element===e?this:new t(e,this.before,this.after)}insertChild(e){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&V(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&V(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&V(224),this.element.replaceChild(e,n),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let n=e==="decorator"&&(Pa||Pc);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let n=this.element,o=e.nodeName==="IMG"?e.nextSibling:null;o&&n.removeChild(o),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,i=document.createElement("br");if(o.insertBefore(i,r),e){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,i),o.__lexicalLineBreak=s}else o.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let n=this.after;n!==null;n=n.previousSibling)e++;return e}resolveChildIndex(e,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,r))]}let i=e1(n,o);i.push(r);let s=e1(n,this.element),a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){let c=i[l],d=s[l];if(c===void 0||c<d)break;if(c>d){a+=1;break}}return[e.getParentOrThrow(),a]}};function e1(t,e){let n=[],o=e;for(;o!==t&&o!==null;o=o.parentNode){let r=0;for(let i=o.previousSibling;i!==null;i=i.previousSibling)r++;n.push(r)}return o!==t&&V(225),n.reverse()}var Ci=class extends vi{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return TK[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getChildrenKeys(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n.__key),n=n.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=st()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(e)}getAllTextNodes(){let e=[],n=this.getFirstChild();for(;n!==null;){if(oe(n)&&e.push(n),K(n)){let o=n.getAllTextNodes();e.push(...o)}n=n.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;K(e);){let n=e.getFirstChild();if(n===null)break;e=n}return e}getLastDescendant(){let e=this.getLastChild();for(;K(e);){let n=e.getLastChild();if(n===null)break;e=n}return e}getDescendantByIndex(e){let n=this.getChildren(),o=n.length;if(e>=o){let i=n[o-1];return K(i)&&i.getLastDescendant()||i||null}let r=n[e];return K(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:$t(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&V(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:$t(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&V(96,this.__key),e}getChildAtIndex(e){let n=this.getChildrenSize(),o,r;if(e<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=e;){if(r===e)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=e;){if(r===e)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let e="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContent(),K(i)&&r!==o-1&&!i.isInline()&&(e+=zr)}return e}getTextContentSize(){let e=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContentSize(),K(i)&&r!==o-1&&!i.isInline()&&(e+=zr.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let n=CN[e];return!!(this.getFormat()&n)}return!1}hasTextFormat(e){let n=hn[e];return!!(this.getTextFormat()&n)}getFormatFlags(e,n){return qp(this.getLatest().__textFormat,e,n)}getTextStyle(){return this.getLatest().__textStyle}select(e,n){Yt();let o=ze(),r=e,i=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&n===0){let l=this.getFirstChild();if(oe(l)||K(l))return l.select(0,0)}else if(!(e!==void 0&&e!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(oe(l)||K(l))return l.select()}}r===void 0&&(r=s),i===void 0&&(i=s);let a=this.__key;return fe(o)?(o.anchor.set(a,r,"element"),o.focus.set(a,i,"element"),o.dirty=!0,o):aD(a,r,a,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach((n=>n.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let n=this.getWritable();return n.__dir=e,n}setFormat(e){return this.getWritable().__format=e!==""?CN[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let n=this.getWritable();return n.__textFormat=e,n}setTextStyle(e){let n=this.getWritable();return n.__textStyle=e,n}setIndent(e){return this.getWritable().__indent=e,this}splice(e,n,o){let r=o.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||V(226,String(e),String(n),String(i));let a=s.__key,l=[],c=[],d=this.getChildAtIndex(e+n),u=null,p=i-n+r;if(e!==0)if(e===i)u=this.getLastChild();else{let g=this.getChildAtIndex(e);g!==null&&(u=g.getPreviousSibling())}if(n>0){let g=u===null?this.getFirstChild():u.getNextSibling();for(let m=0;m<n;m++){g===null&&V(100);let _=g.getNextSibling(),b=g.__key;yi(g.getWritable()),c.push(b),g=_}}let h=u;for(let g=0;g<r;g++){let m=o[g];h!==null&&m.is(h)&&(u=h=h.getPreviousSibling());let _=m.getWritable();_.__parent===a&&p--,yi(_);let b=m.__key;if(h===null)s.__first=b,_.__prev=null;else{let y=h.getWritable();y.__next=b,_.__prev=y.__key}m.__key===a&&V(76),_.__parent=a,l.push(b),h=m}if(e+n===i)h!==null&&(h.getWritable().__next=null,s.__last=h.__key);else if(d!==null){let g=d.getWritable();if(h!==null){let m=h.getWritable();g.__prev=h.__key,m.__next=d.__key}else g.__prev=null}if(s.__size=p,c.length){let g=ze();if(fe(g)){let m=new Set(c),_=new Set(l),{anchor:b,focus:y}=g;t1(b,m,_)&&Wp(b,b.getNode(),this,u,d),t1(y,m,_)&&Wp(y,y.getNode(),this,u,d),p!==0||this.canBeEmpty()||Ro(this)||this.remove()}}return s}getDOMSlot(e){return new ly(e)}exportDOM(e){let{element:n}=super.exportDOM(e);if(kn(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n!==0&&(e.textFormat=n),o!==""&&(e.textStyle=o),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,n){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,n){let o=this.getDOMSlot(e),r=o.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){let s=n.getElementByKey(i.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function K(t){return t instanceof Ci}function t1(t,e,n){let o=t.getNode();for(;o;){let r=o.__key;if(e.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Vc=class extends vi{decorate(e,n){V(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Xe(t){return t instanceof Vc}var Ha=class t extends Ci{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){V(51)}getTextContent(){let e=this.__cachedText;return!Ja()&&st()._dirtyType!==vs||e===null?super.getTextContent():e}remove(){V(52)}replace(e){V(53)}insertBefore(e){V(54)}insertAfter(e){V(55)}updateDOM(e,n){return!1}splice(e,n,o){for(let r of o)K(r)||Xe(r)||V(282);return super.splice(e,n,o)}static importJSON(e){return $n().updateFromJSON(e)}collapseAtStart(){return!0}};function Fn(t){return t instanceof Ha}function fD(t){return new Gp(new Map(t._nodeMap))}function Ry(){return new Gp(new Map([["root",new Ha]]))}function hD(t){let e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&V(130,n.name),K(t)){let o=e.children;Array.isArray(o)||V(59,n.name);let r=t.getChildren();for(let i=0;i<r.length;i++){let s=hD(r[i]);o.push(s)}}return e}var Gp=class t{constructor(e,n){this._nodeMap=e,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,n){return ZN(n&&n.editor||null,this,e)}clone(e){let n=new t(this._nodeMap,e===void 0?this._selection:e);return n._readOnly=!0,n}toJSON(){return ZN(null,this,(()=>({root:hD($n())})))}},h3="historic",g3="history-push",Mp="history-merge",m3="paste",gD="collaboration",_3="skip-collab",mD="skip-scroll-into-view",_D="skip-dom-selection",Yp=class extends Ci{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},Ua=class t extends Ci{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("p"),o=Ra(e.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(e,n,o){return!1}static importDOM(){return{p:e=>({conversion:b3,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(kn(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(e){return Br().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,n){let o=Br();o.setTextFormat(e.format),o.setTextStyle(e.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let e=this.getChildren();if(e.length===0||oe(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function b3(t){let e=Br();return t.style&&(e.setFormat(t.style.textAlign),$D(t,e)),{node:e}}function Br(){return Jc(new Ua)}function y3(t){return t instanceof Ua}var x3=0,v3=1,C3=2,E3=3,w3=4;function bD(t,e,n,o){let r=t._keyToDOMMap;r.clear(),t._editorState=Ry(),t._pendingEditorState=o,t._compositionKey=null,t._dirtyType=vs,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;let i=t._observer;i!==null&&(i.disconnect(),t._observer=null),e!==null&&(e.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function T3(t){let e=t||{},n=p3(),o=e.theme||{},r=t===void 0?n:e.parentEditor||null,i=e.disableEvents||!1,s=Ry(),a=e.namespace||(r!==null?r._config.namespace:SD()),l=e.editorState,c=[Ha,Es,Ba,za,Ua,Yp,...e.nodes||[]],{onError:d,html:u}=e,p=e.editable===void 0||e.editable,h;if(t===void 0&&n!==null)h=n._nodes;else{h=new Map;for(let m=0;m<c.length;m++){let _=c[m],b=null,y=null;if(typeof _!="function"){let k=_;_=k.replace,b=k.with,y=k.withKlass||null}let{ownNodeConfig:v}=qy(_),x=_.getType(),C=_.transform(),E=new Set;v&&v.$transform&&E.add(v.$transform),C!==null&&E.add(C),h.set(x,{exportDOM:u&&u.export?u.export.get(_):void 0,klass:_,replace:b,replaceWithKlass:y,sharedNodeState:v1(c[m]),transforms:E})}}let g=new Ka(s,r,h,{disableEvents:i,namespace:a,theme:o},d||console.error,(function(m,_){let b=new Map,y=new Set,v=x=>{Object.keys(x).forEach((C=>{let E=b.get(C);E===void 0&&(E=[],b.set(C,E)),E.push(x[C])}))};return m.forEach((x=>{let C=x.klass.importDOM;if(C==null||y.has(C))return;y.add(C);let E=C.call(x.klass);E!==null&&v(E)})),_&&v(_),b})(h,u?u.import:void 0),p,t);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=Fa),g}var Ka=class{constructor(e,n,o,r,i,s,a,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=vs,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=SD(),this._onError=i,this._htmlConversions=s,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let n=this._listeners.update;return n.add(e),()=>{n.delete(e)}}registerEditableListener(e){let n=this._listeners.editable;return n.add(e),()=>{n.delete(e)}}registerDecoratorListener(e){let n=this._listeners.decorator;return n.add(e),()=>{n.delete(e)}}registerTextContentListener(e){let n=this._listeners.textcontent;return n.add(e),()=>{n.delete(e)}}registerRootListener(e){let n=this._listeners.root;return e(this._rootElement,null),n.add(e),()=>{e(null,this._rootElement),n.delete(e)}}registerCommand(e,n,o){o===void 0&&V(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&V(36,String(e));let s=i[o];return s.add(n),()=>{s.delete(n),i.every((a=>a.size===0))&&r.delete(e)}}registerMutationListener(e,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(r);let a=o&&o.skipInitialization;return a!==void 0&&a||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&i.delete(n)}}getRegisteredNode(e){let n=this._nodes.get(e.getType());return n===void 0&&V(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,n){let o=this._editorState,r=py(o).get(n.getType());if(!r)return;let i=new Map;for(let s of r.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,n){let o=this.getRegisteredNode(e);return o.transforms.add(n),o}registerNodeTransform(e,n){let o=this.registerNodeTransformToKlass(e,n),r=[o],i=o.replaceWithKlass;if(i!=null){let s=this.registerNodeTransformToKlass(i,n);r.push(s)}return(function(s,a){let l=py(s.getEditorState()),c=[];for(let d of a){let u=l.get(d);u&&c.push(u)}c.length!==0&&s.update((()=>{for(let d of c)for(let u of d.keys()){let p=$t(u);p&&p.markDirty()}}),s._pendingEditorState===null?{tag:Mp}:void 0)})(this,r.map((s=>s.klass.getType()))),()=>{r.forEach((s=>s.transforms.delete(n)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,n){return Q(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let n=this._rootElement;if(e!==n){let o=Ra(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,bD(this,n,e,r),n!==null&&(this._config.disableEvents||XK(n),o!=null&&n.classList.remove(...o)),e!==null){let i=Wy(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Fa,x1(this),this._updateTags.add(Mp),Pr(this),this._config.disableEvents||(function(a,l){let c=a.ownerDocument,d=Kp.get(c);(d===void 0||d<1)&&c.addEventListener("selectionchange",nD),Kp.set(c,(d||0)+1),a.__lexicalEditor=l;let u=tD(a);for(let p=0;p<ny.length;p++){let[h,g]=ny[p],m=typeof g=="function"?_=>{PN(_)||(RN(_),(l.isEditable()||h==="click")&&g(_,l))}:_=>{if(PN(_))return;RN(_);let b=l.isEditable();switch(h){case"cut":return b&&Q(l,Dy,_);case"copy":return Q(l,Ny,_);case"paste":return b&&Q(l,Ty,_);case"dragstart":return b&&Q(l,K1,_);case"dragover":return b&&Q(l,j1,_);case"dragend":return b&&Q(l,V1,_);case"focus":return b&&Q(l,W1,_);case"blur":return b&&Q(l,G1,_);case"drop":return b&&Q(l,U1,_)}};a.addEventListener(h,m),u.push((()=>{a.removeEventListener(h,m)}))}})(e,this),o!=null&&e.classList.add(...o)}else this._window=null,this._updateTags.add(Mp),Pr(this);Mc("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&V(38);let o=e;o._readOnly&&(o=fD(e),o._selection=e._selection?e._selection.clone():null),y1(this);let r=this._pendingEditorState,i=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&i.add(s),Pr(this)),this._pendingEditorState=o,this._dirtyType=Fa,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),this._updating||Pr(this)}parseEditorState(e,n){return(function(o,r,i){let s=Ry(),a=Jt,l=Bn,c=Xt,d=r._dirtyElements,u=r._dirtyLeaves,p=r._cloneNotNeeded,h=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Jt=s,Bn=!1,Xt=r,Py(null);try{let g=r._nodes;My(o.root,g),i&&i(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=d,r._dirtyLeaves=u,r._cloneNotNeeded=p,r._dirtyType=h,Jt=a,Bn=l,Xt=c}return s})(typeof e=="string"?JSON.parse(e):e,this,n)}read(e){return Pr(this),this.getEditorState().read(e,{editor:this})}update(e,n){(function(o,r,i){o._updating?o._updates.push([r,i]):Ly(o,r,i)})(this,e,n)}focus(e,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),ro(this,(()=>{let r=ze(),i=$n();r!==null?r.dirty||zn(r.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),ID("focus"),AD((()=>{o.removeAttribute("autocapitalize"),e&&e()}))})),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let n=or(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Mc("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};Ka.version="0.33.1+prod.esm";var cy=null;function Py(t){cy=t}var yD=1;function S3(){yD=1}function Fy(t,e){let n=By(t,e);return n===void 0&&V(30,e),n}function By(t,e){return t._nodes.get(e)}var k3=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function n1(t){return Xe(lf(t))}function $y(t){let e=document.activeElement;if(!kn(e))return!1;let n=e.nodeName;return Xe(lf(t))&&(n==="INPUT"||n==="TEXTAREA"||e.contentEditable==="true"&&Yc(e)==null)}function Gc(t,e,n){let o=t.getRootElement();try{return o!==null&&o.contains(e)&&o.contains(n)&&e!==null&&!$y(e)&&zy(e)===t}catch{return!1}}function sf(t){return t instanceof Ka}function zy(t){let e=t;for(;e!=null;){let n=Yc(e);if(sf(n))return n;e=qc(e)}return null}function Yc(t){return t?t.__lexicalEditor:null}function bi(t){return Iy(t)||t.isToken()}function Lr(t){return bi(t)||t.isSegmented()}function rr(t){return Xa(t)&&t.nodeType===dK}function xD(t){return Xa(t)&&t.nodeType===uK}function Ts(t){let e=t;for(;e!=null;){if(rr(e))return e;e=e.firstChild}return null}function qp(t,e,n){let o=hn[e];if(n!==null&&(t&o)==(n&o))return t;let r=t^o;return e==="subscript"?r&=~hn.superscript:e==="superscript"?r&=~hn.subscript:e==="lowercase"?(r&=~hn.uppercase,r&=~hn.capitalize):e==="uppercase"?(r&=~hn.lowercase,r&=~hn.capitalize):e==="capitalize"&&(r&=~hn.lowercase,r&=~hn.uppercase),r}function N3(t){return oe(t)||ys(t)||Xe(t)}function vD(t,e){let n=(function(){let s=cy;return cy=null,s})();if((e=e||n&&n.__key)!=null)return void(t.__key=e);Yt(),dD();let o=st(),r=Ur(),i=""+yD++;r._nodeMap.set(i,t),K(t)?o._dirtyElements.set(i,!0):o._dirtyLeaves.add(i),o._cloneNotNeeded.add(i),o._dirtyType=f1,t.__key=i}function yi(t){let e=t.getParent();if(e!==null){let n=t.getWritable(),o=e.getWritable(),r=t.getPreviousSibling(),i=t.getNextSibling(),s=i!==null?i.__key:null,a=r!==null?r.__key:null,l=r!==null?r.getWritable():null,c=i!==null?i.getWritable():null;r===null&&(o.__first=s),i===null&&(o.__last=a),l!==null&&(l.__next=s),c!==null&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Jp(t){dD();let e=t.getLatest(),n=e.__parent,o=Ur(),r=st(),i=o._nodeMap,s=r._dirtyElements;n!==null&&(function(l,c,d){let u=l;for(;u!==null;){if(d.has(u))return;let p=c.get(u);if(p===void 0)break;d.set(u,!1),u=p.__parent}})(n,i,s);let a=e.__key;r._dirtyType=f1,K(t)?s.set(a,!0):r._dirtyLeaves.add(a)}function qt(t){Yt();let e=st(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,n!==null){let o=$t(n);o!==null&&o.getWritable()}if(t!==null){let o=$t(t);o!==null&&o.getWritable()}}}function _i(){return Ja()?null:st()._compositionKey}function $t(t,e){let n=(e||Ur())._nodeMap.get(t);return n===void 0?null:n}function CD(t,e){let n=af(t,st());return n!==void 0?$t(n,e):null}function af(t,e){return t[`__lexicalKey_${e._key}`]}function lf(t,e){let n=t;for(;n!=null;){let o=CD(n,e);if(o!==null)return o;n=qc(n)}return null}function ED(t){let e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function o1(t){return t.read((()=>$n().getTextContent()))}function $n(){return wD(Ur())}function wD(t){return t._nodeMap.get("root")}function zn(t){Yt();let e=Ur();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Aa(t){let e=st(),n=(function(o,r){let i=o;for(;i!=null;){let s=af(i,r);if(s!==void 0)return s;i=qc(i)}return null})(t,e);return n===null?t===e.getRootElement()?$t("root"):null:$t(n)}function r1(t,e){return e?t.getTextContentSize():0}function TD(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Hy(t){let e=[],n=t;for(;n!==null;)e.push(n),n=n._parentEditor;return e}function SD(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function kD(t){return rr(t)?t.nodeValue:null}function Uy(t,e,n){let o=or(Co(e));if(o===null)return;let r=o.anchorNode,{anchorOffset:i,focusOffset:s}=o;if(r!==null){let a=kD(r),l=lf(r);if(a!==null&&oe(l)){if(a===ef&&n){let c=n.length;a=n,i=c,s=c}a!==null&&Ky(l,a,i,s,t)}}}function Ky(t,e,n,o,r){let i=t;if(i.isAttached()&&(r||!i.isDirty())){let s=i.isComposing(),a=e;(s||r)&&e[e.length-1]===ef&&(a=e.slice(0,-1));let l=i.getTextContent();if(r||a!==l){if(a===""){if(qt(null),Pc||Pa||Rp)i.remove();else{let m=st();setTimeout((()=>{m.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}let c=i.getParent(),d=Ns(),u=i.getTextContentSize(),p=_i(),h=i.getKey();if(i.isToken()||p!==null&&h===p&&!s||fe(d)&&(c!==null&&!c.canInsertTextBefore()&&d.anchor.offset===0||d.anchor.key===t.__key&&d.anchor.offset===0&&!i.canInsertTextBefore()&&!s||d.focus.key===t.__key&&d.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();let g=ze();if(!fe(g)||n===null||o===null)return void i.setTextContent(a);if(g.setTextNodeRange(i,n,i,o),i.isSegmented()){let m=Gt(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function Np(t,e,n){let o=e[n]||!1;return o==="any"||o===t[n]}function ND(t,e){return Np(t,e,"altKey")&&Np(t,e,"ctrlKey")&&Np(t,e,"shiftKey")&&Np(t,e,"metaKey")}function Ge(t,e,n){return ND(t,n)&&t.key.toLowerCase()===e.toLowerCase()}var Mr={ctrlKey:!nr,metaKey:nr},i1={altKey:nr,ctrlKey:!nr};function s1(t){return t.key==="Backspace"}function a1(t){return Ge(t,"a",Mr)}function D3(t){let e=$n();if(fe(t)){let n=t.anchor,o=t.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Bp(t),t}{let n=e.select(0,e.getChildrenSize());return zn(Bp(n)),n}}function Ra(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let n=t.__lexicalClassNameCache,o=n[e];if(o!==void 0)return o;let r=t[e];if(typeof r=="string"){let i=Pp(r);return n[e]=i,i}return r}function jy(t,e,n,o,r){if(n.size===0)return;let i=o.__type,s=o.__key,a=e.get(i);a===void 0&&V(33,i);let l=a.klass,c=t.get(l);c===void 0&&(c=new Map,t.set(l,c));let d=c.get(s),u=d==="destroyed"&&r==="created";(d===void 0||u)&&c.set(s,u?"updated":r)}function O3(t){let e=t.getType(),n=Ur();if(n._readOnly){let i=py(n).get(e);return i?Array.from(i.values()):[]}let o=n._nodeMap,r=[];for(let[,i]of o)i instanceof t&&i.__type===e&&i.isAttached()&&r.push(i);return r}function l1(t,e,n){let o=t.getParent(),r=n,i=t;return o!==null&&(e&&n===0?(r=i.getIndexWithinParent(),i=o):e||n!==i.getChildrenSize()||(r=i.getIndexWithinParent()+1,i=o)),i.getChildAtIndex(e?r-1:r)}function DD(t,e){let n=t.offset;if(t.type==="element")return l1(t.getNode(),e,n);{let o=t.getNode();if(e&&n===0||!e&&n===o.getTextContentSize()){let r=e?o.getPreviousSibling():o.getNextSibling();return r===null?l1(o.getParentOrThrow(),e,o.getIndexWithinParent()+(e?0:1)):r}}return null}function OD(t){let e=Co(t).event,n=e&&e.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Q(t,e,n){return(function(o,r,i){let s=Hy(o);for(let a=4;a>=0;a--)for(let l=0;l<s.length;l++){let c=s[l],d=c._commands.get(r);if(d!==void 0){let u=d[a];if(u!==void 0){let p=Array.from(u),h=p.length,g=!1;if(ro(c,(()=>{for(let m=0;m<h;m++)if(p[m](i,o))return void(g=!0)})),g)return g}}}return!1})(t,e,n)}function cf(t){return!Fn(t)&&!t.isLastChild()&&!t.isInline()}function ja(t,e){let n=t._keyToDOMMap.get(e);return n===void 0&&V(75,e),n}function qc(t){let e=t.assignedSlot||t.parentElement;return PD(e)?e.host:e}function Vy(t){return xD(t)?t:kn(t)?t.ownerDocument:null}function I3(t){return st()._updateTags.has(t)}function ID(t){Yt(),st()._updateTags.add(t)}function AD(t){Yt(),st()._deferred.push(t)}function Xp(t,e){let n=t.getParent();for(;n!==null;){if(n.is(e))return!0;n=n.getParent()}return!1}function Wy(t){let e=Vy(t);return e?e.defaultView:null}function Co(t){let e=t._window;return e===null&&V(78),e}function A3(t){return K(t)&&t.isInline()||Xe(t)&&t.isInline()}function MD(t){let e=t.getParentOrThrow();for(;e!==null;){if(Ro(e))return e;e=e.getParentOrThrow()}return e}function Ro(t){return Fn(t)||K(t)&&t.isShadowRoot()}function Gy(t){let e=t.constructor.clone(t);return vD(e,null),e.afterCloneFrom(t),e}function Jc(t){let e=st(),n=t.getType(),o=By(e,n);o===void 0&&V(200,t.constructor.name,n);let{replace:r,replaceWithKlass:i}=o;if(r!==null){let s=r(t),a=s.constructor;return i!==null?s instanceof i||V(201,i.name,i.getType(),a.name,a.getType(),t.constructor.name,n):s instanceof t.constructor&&a!==t.constructor||V(202,a.name,a.getType(),t.constructor.name,n),s.__key===t.__key&&V(203,t.constructor.name,n,a.name,a.getType()),s}return t}function $b(t,e){!Fn(t.getParent())||K(e)||Xe(e)||V(99)}function LD(t){let e=$t(t);return e===null&&V(63,t),e}function zb(t){return(Xe(t)||K(t)&&!t.canBeEmpty())&&!t.isInline()}function dy(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;let o=t.parentElement;o!==null&&o.removeChild(t)}function or(t){return Po?(t||window).getSelection():null}function RD(t){let e=Wy(t);return e?e.getSelection():null}function M3(t,e){let n=t.getChildAtIndex(e);n==null&&(n=t),Ro(t)&&V(102);let o=s=>{let a=s.getParentOrThrow(),l=Ro(a),c=s!==n||l?Gy(s):s;if(l)return K(s)&&K(c)||V(133),s.insertAfter(c),[s,c,c];{let[d,u,p]=o(a),h=s.getNextSiblings();return p.append(c,...h),[d,u,c]}},[r,i]=o(n);return[r,i]}function L3(t){return kn(t)&&t.tagName==="A"}function kn(t){return Xa(t)&&t.nodeType===cK}function Xa(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function PD(t){return Xa(t)&&t.nodeType===pK}function FD(t){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return t.nodeName.match(e)!==null}function uy(t){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return t.nodeName.match(e)!==null}function Fr(t){if(Xe(t)&&!t.isInline())return!0;if(!K(t)||Ro(t))return!1;let e=t.getFirstChild(),n=e===null||ys(e)||oe(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&n}function Hb(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}function Yy(){return st()}var c1=new WeakMap,R3=new Map;function py(t){if(!t._readOnly&&t.isEmpty())return R3;t._readOnly||V(192);let e=c1.get(t);return e||(e=(function(n){let o=new Map;for(let[r,i]of n._nodeMap){let s=i.__type,a=o.get(s);a||(a=new Map,o.set(s,a)),a.set(r,i)}return o})(t),c1.set(t,e)),e}function BD(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function $D(t,e){let n=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(n/40);e.setIndent(o)}function P3(t){t.__lexicalUnmanaged=!0}function zD(t){return t.__lexicalUnmanaged===!0}function Nc(t,e){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(t,e)&&t[e]!==vi[e]}function qy(t){let e=EN in t.prototype?t.prototype[EN]():void 0,n=(function(s){return s===Vc||s===Ci||s===vi})(t),o=!n&&Nc(t,"getType")?t.getType():void 0,r,i=o;if(e)if(o)r=e[o];else for(let[s,a]of Object.entries(e))i=s,r=a;if(!n&&i&&(Nc(t,"getType")||(t.getType=()=>i),Nc(t,"clone")||(t.clone=s=>(Py(s),new t)),Nc(t,"importJSON")||(t.importJSON=r&&r.$importJSON||(s=>new t().updateFromJSON(s))),!Nc(t,"importDOM")&&r)){let{importDOM:s}=r;s&&(t.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:i}}function F3(t){let e=Yy();return Yt(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var B3={next:"previous",previous:"next"},Va=class{constructor(e){this.origin=e}[Symbol.iterator](){return Zy({hasNext:Ss,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Zt(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Zt(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,n){let o=this.getNodeAtCaret();return e.is(this.origin)||e.is(o)||(o===null?this.insert(e):o.replace(e,n)),this}splice(e,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),i=this,s=this.getParentAtCaret(),a=new Map;for(let l=i.getAdjacentCaret();l!==null&&a.size<e;l=l.getAdjacentCaret()){let c=l.origin.getWritable();a.set(c.getKey(),c)}for(let l of r){if(a.size>0){let c=i.getNodeAtCaret();if(c){if(a.delete(c.getKey()),a.delete(l.getKey()),!(c.is(l)||i.origin.is(l))){let d=l.getParent();d&&d.is(s)&&l.remove(),c.replace(l)}}else c===null&&V(263,Array.from(a).join(" "))}else i.insert(l);i=Zt(l,this.direction)}for(let l of a.values())l.remove();return this}},Wc=class t extends Va{type="child";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Hr(e,this.direction)}getParentCaret(e="root"){return Zt(Jy(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=ki(this.direction);return Zt(this.getNodeAtCaret(),e)||Hr(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},$3={root:Fn,shadowRoot:Ro};function ki(t){return B3[t]}function Jy(t,e="root"){return $3[e](t)?null:t}var Wa=class t extends Va{type="sibling";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Zt(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return K(this.origin)?Hr(this.origin,this.direction):null}getParentCaret(e="root"){return Zt(Jy(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=ki(this.direction);return Zt(this.getNodeAtCaret(),e)||Hr(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof t||e instanceof Ga)&&this.direction===e.direction&&this.origin.is(e.origin)}},Ga=class t extends Va{type="text";constructor(e,n){super(e),this.offset=n}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Ei(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Zt(Jy(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Ei(this.origin,ki(this.direction),this.offset)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Wa||e instanceof t)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Zt(this.origin,this.direction)}};function $r(t){return t instanceof Ga}function z3(t){return t instanceof Va}function Ss(t){return t instanceof Wa}function Mo(t){return t instanceof Wc}var H3={next:class extends Ga{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Ga{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},U3={next:class extends Wa{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Wa{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},K3={next:class extends Wc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Wc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Zt(t,e){return t?new U3[e](t):null}function Ei(t,e,n){return t?new H3[e](t,ks(t,n)):null}function ks(t,e){let n=t.getTextContentSize(),o=e==="next"?n:e==="previous"?0:e;return(o<0||o>n)&&((function(r,...i){let s=new URL("https://lexical.dev/docs/error"),a=new URLSearchParams;a.append("code",r);for(let l of i)a.append("v",l);s.search=a.toString(),console.warn(`Minified Lexical warning #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(284,String(e),String(n),t.getKey()),o=o<0?0:n),o}function fy(t,e){return new Zp(t,e)}function Hr(t,e){return K(t)?new K3[e](t):null}function HD(t){return t&&t.getChildCaret()||t}function Ya(t){return t&&HD(t.getAdjacentCaret())}var hy=class t{type="node-caret-range";constructor(e,n,o){this.anchor=e,this.focus=n,this.direction=o}getLatest(){let e=this.anchor.getLatest(),n=this.focus.getLatest();return e===this.anchor&&n===this.focus?this:new t(e,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=r=>{let i=this[r].getLatest();return $r(i)?(function(s,a){let{direction:l,origin:c}=s,d=ks(c,a==="focus"?ki(l):l);return fy(s,d-s.offset)})(i,r):null},n=e("anchor"),o=e("focus");if(n&&o){let{caret:r}=n,{caret:i}=o;if(r.isSameNodeCaret(i))return[fy(r,i.offset-r.offset),null]}return[n,o]}iterNodeCarets(e="root"){let n=$r(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=$r(o),i=s=>s.isSameNodeCaret(o)?null:Ya(s)||s.getParentCaret(e);return Zy({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Zp=class{type="slice";constructor(e,n){this.caret=e,this.distance=n}getSliceIndices(){let{distance:e,caret:{offset:n}}=this,o=n+e;return o<n?[o,n]:[n,o]}getTextContent(){let[e,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:n}}=this,[o,r]=this.getSliceIndices(),i=e.getTextContent();return Ei(e.setTextContent(i.slice(0,o)+i.slice(r)),n,o)}};function j3(t){return t instanceof Zp}function Xy(t){return wi(t,Zt($n(),t.direction))}function UD(t){return wi(t,t)}function wi(t,e){return t.direction!==e.direction&&V(265),new hy(t,e,t.direction)}function Zy(t){let{initial:e,hasNext:n,step:o,map:r}=t,i=e;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};let s={done:!1,value:r(i)};return i=o(i),s}}}function Qy(t,e){let n=Lc(t.origin,e.origin);switch(n===null&&V(275,t.origin.getKey(),e.origin.getKey()),n.type){case"same":{let o=t.type==="text",r=e.type==="text";return o&&r?(function(i,s){return Math.sign(i-s)})(t.offset,e.offset):t.type===e.type?0:o?-1:r?1:t.type==="child"?-1:1}case"ancestor":return t.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return ex(n)}}function ex(t){let{a:e,b:n}=t,o=e.__key,r=n.__key,i=e,s=n;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===r)return-1;if(s.__key===o)return 1}return i===null?1:-1}function Dp(t,e){return e.is(t)}function d1(t){return K(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Lc(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let n=new Map;for(let[o,r]=d1(t);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=d1(e);o;r=o,o=o.getParent()){let i=n.get(o);if(i!==void 0)return i===null?(Dp(t,o)||V(276),{commonAncestor:o,type:"ancestor"}):r===null?(Dp(e,o)||V(277),{commonAncestor:o,type:"descendant"}):((K(i)||Dp(t,i))&&(K(r)||Dp(e,r))&&o.is(i.getParent())&&o.is(r.getParent())||V(278),{a:i,b:r,commonAncestor:o,type:"branch"})}return null}function Ti(t,e){let{type:n,key:o,offset:r}=t,i=LD(t.key);return n==="text"?(oe(i)||V(266,i.getType(),o),Ei(i,e,r)):(K(i)||V(267,i.getType(),o),WD(i,t.offset,e))}function qa(t,e){let{origin:n,direction:o}=e,r=o==="next";$r(e)?t.set(n.getKey(),e.offset,"text"):Ss(e)?oe(n)?t.set(n.getKey(),ks(n,o),"text"):t.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Mo(e)&&K(n)||V(268),t.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function KD(t){let e=ze(),n=fe(e)?e:lD();return Rc(n,t),zn(n),n}function Rc(t,e){qa(t.anchor,e.anchor),qa(t.focus,e.focus)}function gy(t){let{anchor:e,focus:n}=t,o=Ti(e,"next"),r=Ti(n,"next"),i=Qy(o,r)<=0?"next":"previous";return wi(Si(o,i),Si(r,i))}function Za(t){let{direction:e,origin:n}=t,o=Zt(n,ki(e)).getNodeAtCaret();return o?Zt(o,e):Hr(n.getParentOrThrow(),e)}function u1(t,e="root"){let n=[t];for(let o=Mo(t)?t.getParentCaret(e):t.getSiblingCaret();o!==null;o=o.getParentCaret(e))n.push(Za(o));return n}function Ub(t){return!!t&&t.origin.isAttached()}function jD(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let n="root",o="next",r=e,i=tx(t,o),s=u1(i.anchor,n),a=u1(i.focus.getFlipped(),n),l=new Set,c=[];for(let g of i.iterNodeCarets(n))if(Mo(g))l.add(g.origin.getKey());else if(Ss(g)){let{origin:m}=g;K(m)&&!l.has(m.getKey())||c.push(m)}for(let g of c)g.remove();for(let g of i.getTextSlices()){if(!g)continue;let{origin:m}=g.caret,_=m.getTextContentSize(),b=Za(Zt(m,o)),y=m.getMode();if(Math.abs(g.distance)===_&&r==="removeEmptySlices"||y==="token"&&g.distance!==0)b.remove();else if(g.distance!==0){r="removeEmptySlices";let v=g.removeTextSlice(),x=g.caret.origin;if(y==="segmented"){let C=v.origin,E=Gt(C.getTextContent()).setStyle(C.getStyle()).setFormat(C.getFormat());b.replaceOrInsert(E),v=Ei(E,o,v.offset)}x.is(s[0].origin)&&(s[0]=v),x.is(a[0].origin)&&(a[0]=v.getFlipped())}}let d,u;for(let g of s)if(Ub(g)){d=Io(g);break}for(let g of a)if(Ub(g)){u=Io(g);break}let p=(function(g,m,_){if(!g||!m)return null;let b=g.getParentAtCaret(),y=m.getParentAtCaret();if(!b||!y)return null;let v=b.getParents().reverse();v.push(b);let x=y.getParents().reverse();x.push(y);let C=Math.min(v.length,x.length),E;for(E=0;E<C&&v[E]===x[E];E++);let k=(S,N)=>{let D;for(let O=E;O<S.length;O++){let A=S[O];if(Ro(A))return;!D&&N(A)&&(D=A)}return D},T=k(v,Fr),w=T&&k(x,(S=>_.has(S.getKey())&&Fr(S)));return T&&w?[T,w]:null})(d,u,l);if(p){let[g,m]=p;Hr(g,"previous").splice(0,m.getChildren()),m.remove()}let h=[d,u,...s,...a].find(Ub);if(h)return UD(Si(Io(h),t.direction));V(269,JSON.stringify(s.map((g=>g.origin.__key))))}function Io(t){let e=(function(r){let i=r;for(;Mo(i);){let s=Ya(i);if(!Mo(s))break;i=s}return i})(t.getLatest()),{direction:n}=e;if(oe(e.origin))return $r(e)?e:Ei(e.origin,n,n);let o=e.getAdjacentCaret();return Ss(o)&&oe(o.origin)?Ei(o.origin,n,ki(n)):e}function VD(t){return $r(t)&&t.offset!==ks(t.origin,t.direction)}function Si(t,e){return t.direction===e?t:t.getFlipped()}function tx(t,e){return t.direction===e?t:wi(Si(t.focus,e),Si(t.anchor,e))}function WD(t,e,n){let o=Hr(t,"next");for(let r=0;r<e;r++){let i=o.getAdjacentCaret();if(i===null)break;o=i}return Si(o,n)}function V3(t,e="root"){let n=0,o=t,r=Ya(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=Ya(o)}return r&&[r,n]}function W3(t){let{origin:e,offset:n,direction:o}=t;if(n===ks(e,o))return t.getSiblingCaret();if(n===ks(e,ki(o)))return Za(t.getSiblingCaret());let[r]=e.splitText(n);return oe(r)||V(281),Si(Zt(r,"next"),o)}function G3(t,e){return!0}function Y3(t,{$copyElementNode:e=Gy,$splitTextPointCaretNext:n=W3,rootMode:o="shadowRoot",$shouldSplit:r=G3}={}){if($r(t))return n(t);let i=t.getParentCaret(o);if(i){let{origin:s}=i;if(Mo(t)&&(!s.canBeEmpty()||!r(s,"first")))return Za(i);let a=(function(l){let c=[];for(let d=l.getAdjacentCaret();d;d=d.getAdjacentCaret())c.push(d.origin);return c})(t);(a.length>0||s.canBeEmpty()&&r(s,"last"))&&i.insert(e(s).splice(0,0,a))}return i}var M=nx,qte=M.$addUpdateTag,At=M.$applyNodeReplacement,Ni=M.$caretFromPoint,GD=M.$caretRangeFromSelection,Di=M.$cloneWithProperties,Jte=M.$comparePointCaretNext,Xte=M.$copyNode,Zte=M.$create,Fo=M.$createLineBreakNode,YD=M.$createNodeSelection,ge=M.$createParagraphNode,ir=M.$createPoint,sr=M.$createRangeSelection,qD=M.$createRangeSelectionFromDom,Bo=M.$createTabNode,kt=M.$createTextNode,Xc=M.$extendCaretToRange,Ds=M.$getAdjacentChildCaret,ox=M.$getAdjacentNode,Qte=M.$getAdjacentSiblingOrParentSiblingCaret,rx=M.$getCaretInDirection,df=M.$getCaretRange,JD=M.$getCaretRangeInDirection,XD=M.$getCharacterOffsets,io=M.$getChildCaret,ene=M.$getChildCaretAtIndex,ix=M.$getChildCaretOrSelf,ZD=M.$getCollapsedCaretRange,tne=M.$getCommonAncestor,nne=M.$getCommonAncestorResultBranchOrder,Os=M.$getEditor,ln=M.$getNearestNodeFromDOMNode,one=M.$getNearestRootOrShadowRoot,Mt=M.$getNodeByKey,rne=M.$getNodeByKeyOrThrow,Kr=M.$getPreviousSelection,tt=M.$getRoot,z=M.$getSelection,Nn=M.$getSiblingCaret,QD=M.$getState,ine=M.$getStateChange,sne=M.$getTextContent,ane=M.$getTextNodeOffset,eO=M.$getTextPointCaret,lne=M.$getTextPointCaretSlice,cne=M.$getWritableNodeState,tO=M.$hasAncestor,dne=M.$hasUpdateTag,$o=M.$insertNodes,Qa=M.$isBlockElementNode,Oi=M.$isChildCaret,Hn=M.$isDecoratorNode,Y=M.$isElementNode,uf=M.$isExtendableTextPointCaret,nO=M.$isInlineElementOrDecoratorNode,Zc=M.$isLeafNode,Ze=M.$isLineBreakNode,une=M.$isNodeCaret,gt=M.$isNodeSelection,Qt=M.$isParagraphNode,B=M.$isRangeSelection,ar=M.$isRootNode,zt=M.$isRootOrShadowRoot,pf=M.$isSiblingCaret,Un=M.$isTabNode,te=M.$isTextNode,ff=M.$isTextPointCaret,pne=M.$isTextPointCaretSlice,sx=M.$isTokenOrSegmented,fne=M.$isTokenOrTab,hne=M.$nodesOfType,lr=M.$normalizeCaret,jr=M.$normalizeSelection__EXPERIMENTAL,gne=M.$onUpdate,oO=M.$parseSerializedNode,mne=M.$removeTextFromCaretRange,rO=M.$rewindSiblingCaret,hf=M.$selectAll,_ne=M.$setCompositionKey,Ii=M.$setPointFromCaret,vt=M.$setSelection,gf=M.$setSelectionFromCaretRange,iO=M.$setState,sO=M.$splitAtPointCaretNext,aO=M.$splitNode,bne=M.$updateRangeSelectionFromCaretRange,ax=M.ArtificialNode__DO_NOT_USE,yne=M.BLUR_COMMAND,Is=M.CAN_REDO_COMMAND,As=M.CAN_UNDO_COMMAND,lO=M.CLEAR_EDITOR_COMMAND,cO=M.CLEAR_HISTORY_COMMAND,cr=M.CLICK_COMMAND,dO=M.COLLABORATION_TAG,Nt=M.COMMAND_PRIORITY_CRITICAL,Te=M.COMMAND_PRIORITY_EDITOR,Ai=M.COMMAND_PRIORITY_HIGH,Re=M.COMMAND_PRIORITY_LOW,mf=M.COMMAND_PRIORITY_NORMAL,_f=M.CONTROLLED_TEXT_INSERTION_COMMAND,bf=M.COPY_COMMAND,yf=M.CUT_COMMAND,el=M.DELETE_CHARACTER_COMMAND,Qc=M.DELETE_LINE_COMMAND,xf=M.DELETE_WORD_COMMAND,xne=M.DRAGEND_COMMAND,uO=M.DRAGOVER_COMMAND,pO=M.DRAGSTART_COMMAND,fO=M.DROP_COMMAND,tl=M.DecoratorNode,Ht=M.ElementNode,hO=M.FOCUS_COMMAND,vf=M.FORMAT_ELEMENT_COMMAND,at=M.FORMAT_TEXT_COMMAND,nl=M.HISTORIC_TAG,ol=M.HISTORY_MERGE_TAG,gO=M.HISTORY_PUSH_TAG,Kn=M.INDENT_CONTENT_COMMAND,lx=M.INSERT_LINE_BREAK_COMMAND,Mi=M.INSERT_PARAGRAPH_COMMAND,Ms=M.INSERT_TAB_COMMAND,ed=M.INTERNAL_$isBlock,vne=M.IS_ALL_FORMATTING,Cne=M.IS_BOLD,Ene=M.IS_CODE,wne=M.IS_HIGHLIGHT,Tne=M.IS_ITALIC,Sne=M.IS_STRIKETHROUGH,kne=M.IS_SUBSCRIPT,Nne=M.IS_SUPERSCRIPT,Dne=M.IS_UNDERLINE,Vr=M.KEY_ARROW_DOWN_COMMAND,rl=M.KEY_ARROW_LEFT_COMMAND,Cf=M.KEY_ARROW_RIGHT_COMMAND,zo=M.KEY_ARROW_UP_COMMAND,Ef=M.KEY_BACKSPACE_COMMAND,wf=M.KEY_DELETE_COMMAND,mO=M.KEY_DOWN_COMMAND,_O=M.KEY_ENTER_COMMAND,Li=M.KEY_ESCAPE_COMMAND,One=M.KEY_MODIFIER_COMMAND,Tf=M.KEY_SPACE_COMMAND,Ri=M.KEY_TAB_COMMAND,Ine=M.LineBreakNode,cx=M.MOVE_TO_END,Sf=M.MOVE_TO_START,Ane=M.NODE_STATE_KEY,Eo=M.OUTDENT_CONTENT_COMMAND,Pi=M.PASTE_COMMAND,bO=M.PASTE_TAG,Mne=M.ParagraphNode,yO=M.REDO_COMMAND,xO=M.REMOVE_TEXT_COMMAND,vO=M.RootNode,gn=M.SELECTION_CHANGE_COMMAND,td=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,CO=M.SELECT_ALL_COMMAND,Lne=M.SKIP_COLLAB_TAG,Rne=M.SKIP_DOM_SELECTION_TAG,Pne=M.SKIP_SCROLL_INTO_VIEW_TAG,EO=M.TEXT_TYPE_TO_FORMAT,Fne=M.TabNode,Ut=M.TextNode,wO=M.UNDO_COMMAND,dx=M.buildImportMap,jn=M.createCommand,TO=M.createEditor,Bne=M.createSharedNodeState,$ne=M.createState,zne=M.flipDirection,Hne=M.getDOMOwnerDocument,so=M.getDOMSelection,Une=M.getDOMSelectionFromTarget,SO=M.getDOMTextNode,Kne=M.getEditorPropertyFromDOMNode,kO=M.getNearestEditorFromDOMNode,NO=M.getRegisteredNode,jne=M.getRegisteredNodeOrThrow,DO=M.isBlockDomNode,OO=M.isCurrentlyReadOnlyMode,Vne=M.isDOMDocumentNode,Fi=M.isDOMNode,Wne=M.isDOMTextNode,Gne=M.isDOMUnmanaged,ux=M.isDocumentFragment,Yne=M.isExactShortcutMatch,IO=M.isHTMLAnchorElement,Ls=M.isHTMLElement,nd=M.isInlineDomNode,qne=M.isLexicalEditor,Vn=M.isModifierMatch,AO=M.isSelectionCapturedInDecoratorInput,MO=M.isSelectionWithinEditor,px=M.makeStepwiseIterator,Jne=M.removeFromParent,Xne=M.resetRandomKey,LO=M.setDOMUnmanaged,fx=M.setNodeIndentFromDOM;var bx={};$e(bx,{$addNodeStyle:()=>Q3,$cloneWithProperties:()=>Di,$copyBlockFormatIndent:()=>KO,$ensureForwardRangeSelection:()=>UO,$forEachSelectedTextNode:()=>HO,$getSelectionStyleValueForProperty:()=>aj,$isAtNodeEnd:()=>Z3,$isParentElementRTL:()=>WO,$moveCaretSelection:()=>VO,$moveCharacter:()=>ij,$patchStyleText:()=>ej,$selectAll:()=>hf,$setBlocksType:()=>tj,$shouldOverrideDefaultCharacterSelection:()=>rj,$sliceSelectedTextNodeContent:()=>X3,$trimTextContentFromAnchor:()=>zO,$wrapNodes:()=>oj,createDOMRange:()=>q3,createRectsFromDOMRange:()=>J3,getCSSFromStyleObject:()=>$O,getStyleObjectFromCSS:()=>Nf,trimTextContentFromAnchor:()=>lj});function _x(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var kf=new Map;function RO(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function PO(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function q3(t,e,n,o,r){let i=e.getKey(),s=o.getKey(),a=document.createRange(),l=t.getElementByKey(i),c=t.getElementByKey(s),d=n,u=r;if(te(e)&&(l=RO(l)),te(o)&&(c=RO(c)),e===void 0||o===void 0||l===null||c===null)return null;l.nodeName==="BR"&&([l,d]=PO(l)),c.nodeName==="BR"&&([c,u]=PO(c));let p=l.firstChild;l===c&&p!=null&&p.nodeName==="BR"&&d===0&&u===0&&(u=1);try{a.setStart(l,d),a.setEnd(c,u)}catch{return null}return!a.collapsed||d===u&&i===s||(a.setStart(c,u),a.setEnd(l,d)),a}function J3(t,e){let n=t.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),i=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(e.getClientRects()),a,l=s.length;s.sort(((c,d)=>{let u=c.top-d.top;return Math.abs(u)<=3?c.left-d.left:u}));for(let c=0;c<l;c++){let d=s[c],u=a&&a.top<=d.top&&a.top+a.height>d.top&&a.left+a.width>d.left,p=d.width+i===o.width;u||p?(s.splice(c--,1),l--):a=d}return s}function BO(t){let e={};if(!t)return e;let n=t.split(";");for(let o of n)if(o!==""){let[r,i]=o.split(/:([^]+)/);r&&i&&(e[r.trim()]=i.trim())}return e}function Nf(t){let e=kf.get(t);return e===void 0&&(e=BO(t),kf.set(t,e)),e}function $O(t){let e="";for(let n in t)n&&(e+=`${n}: ${t[n]};`);return e}function X3(t,e){let n=t.getStartEndPoints();if(e.isSelected(t)&&!sx(e)&&n!==null){let[o,r]=n,i=t.isBackward(),s=o.getNode(),a=r.getNode(),l=e.is(s),c=e.is(a);if(l||c){let[d,u]=XD(t),p=s.is(a),h=e.is(i?a:s),g=e.is(i?s:a),m,_=0;p?(_=d>u?u:d,m=d>u?d:u):h?(_=i?u:d,m=void 0):g&&(_=0,m=i?d:u),e.__text=e.__text.slice(_,m)}}return e}function Z3(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return Y(e)||_x(177),t.offset===e.getChildrenSize()}function zO(t,e,n){let o=e.getNode(),r=n;if(Y(o)){let i=o.getDescendantByIndex(e.offset);i!==null&&(o=i)}for(;r>0&&o!==null;){if(Y(o)){let c=o.getLastDescendant();c!==null&&(o=c)}let i=o.getPreviousSibling(),s=0;if(i===null){let c=o.getParentOrThrow(),d=c.getPreviousSibling();for(;d===null;){if(c=c.getParent(),c===null){i=null;break}d=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,i=d)}let a=o.getTextContent();a===""&&Y(o)&&!o.isInline()&&(a=`
114
+
115
+ `);let l=a.length;if(!te(o)||r>=l){let c=o.getParent();o.remove(),c==null||c.getChildrenSize()!==0||ar(c)||c.remove(),r-=l+s,o=i}else{let c=o.getKey(),d=t.getEditorState().read((()=>{let h=Mt(c);return te(h)&&h.isSimpleText()?h.getTextContent():null})),u=l-r,p=a.slice(0,u);if(d!==null&&d!==a){let h=Kr(),g=o;if(o.isSimpleText())o.setTextContent(d);else{let m=kt(d);o.replace(m),g=m}if(B(h)&&h.isCollapsed()){let m=h.anchor.offset;g.select(m,m)}}else if(o.isSimpleText()){let h=e.key===c,g=e.offset;g<r&&(g=l);let m=h?g-r:0,_=h?g:u;if(h&&m===0){let[b]=o.splitText(m,_);b.remove()}else{let[,b]=o.splitText(m,_);b.remove()}}else{let h=kt(p);o.replace(h)}r=0}}}function Q3(t){let e=t.getStyle(),n=BO(e);kf.set(e,n)}function hx(t,e){(B(t)?t.isCollapsed():te(t)||Y(t))||_x(280);let n=Nf(B(t)?t.style:te(t)?t.getStyle():t.getTextStyle()),o=Object.entries(e).reduce(((i,[s,a])=>(typeof a=="function"?i[s]=a(n[s],t):a===null?delete i[s]:i[s]=a,i)),{...n}),r=$O(o);B(t)||te(t)?t.setStyle(r):t.setTextStyle(r),kf.set(r,o)}function ej(t,e){if(B(t)&&t.isCollapsed()){hx(t,e);let n=t.anchor.getNode();Y(n)&&n.isEmpty()&&hx(n,e)}HO((n=>{hx(n,e)}))}function HO(t){let e=z();if(!e)return;let n=new Map;if(B(e))for(let i of GD(e).getTextSlices())i&&n.set(i.caret.origin.getKey(),i.getSliceIndices());let o=e.getNodes();for(let i of o){if(!te(i)||!i.canHaveFormat())continue;let[s,a]=(r=i,n.get(r.getKey())||[0,r.getTextContentSize()]);a!==s&&(sx(i)||s===0&&a===i.getTextContentSize()?t(i):t(i.splitText(s,a)[s===0?0:1]))}var r;B(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&UO(e)}function UO(t){if(t.isBackward()){let{anchor:e,focus:n}=t,{key:o,offset:r,type:i}=e;e.set(n.key,n.offset,n.type),n.set(o,r,i)}}function KO(t,e){let n=t.getFormatType(),o=t.getIndent();n!==e.getFormatType()&&e.setFormat(n),o!==e.getIndent()&&e.setIndent(o)}function tj(t,e,n=KO){if(t===null)return;let o=t.getStartEndPoints(),r=new Map,i=null;if(o){let[s,a]=o;i=sr(),i.anchor.set(s.key,s.offset,s.type),i.focus.set(a.key,a.offset,a.type);let l=mx(s.getNode(),ed),c=mx(a.getNode(),ed);Y(l)&&r.set(l.getKey(),l),Y(c)&&r.set(c.getKey(),c)}for(let s of t.getNodes())if(Y(s)&&ed(s))r.set(s.getKey(),s);else if(o===null){let a=mx(s,ed);Y(a)&&r.set(a.getKey(),a)}for(let[s,a]of r){let l=e();n(a,l),a.replace(l,!0),i&&(s===i.anchor.key&&i.anchor.set(l.getKey(),i.anchor.offset,i.anchor.type),s===i.focus.key&&i.focus.set(l.getKey(),i.focus.offset,i.focus.type))}i&&t.is(z())&&vt(i)}function FO(t){return t.getNode().isAttached()}function nj(t){let e=t;for(;e!==null&&!zt(e);){let n=e.getLatest(),o=e.getParent();n.getChildrenSize()===0&&e.remove(!0),e=o}}function oj(t,e,n=null){let o=t.getStartEndPoints(),r=o?o[0]:null,i=t.getNodes(),s=i.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),d=c.getChildren(),u=e();return u.setFormat(c.getFormatType()),u.setIndent(c.getIndent()),d.forEach((p=>u.append(p))),n&&(u=n.append(u)),void c.replace(u)}let a=null,l=[];for(let c=0;c<s;c++){let d=i[c];zt(d)?(gx(t,l,l.length,e,n),l=[],a=d):a===null||a!==null&&tO(d,a)?l.push(d):(gx(t,l,l.length,e,n),l=[d])}gx(t,l,l.length,e,n)}function gx(t,e,n,o,r=null){if(e.length===0)return;let i=e[0],s=new Map,a=[],l=Y(i)?i:i.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let c=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,c=!0;break}if(l=l.getParentOrThrow(),zt(l))break}let d=new Set;for(let g=0;g<n;g++){let m=e[g];Y(m)&&m.getChildrenSize()===0&&d.add(m.getKey())}let u=new Set;for(let g=0;g<n;g++){let m=e[g],_=m.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&Zc(m)&&!u.has(m.getKey())){let b=_.getKey();if(s.get(b)===void 0){let y=o();y.setFormat(_.getFormatType()),y.setIndent(_.getIndent()),a.push(y),s.set(b,y),_.getChildren().forEach((v=>{y.append(v),u.add(v.getKey()),Y(v)&&v.getChildrenKeys().forEach((x=>u.add(x)))})),nj(_)}}else if(d.has(m.getKey())){Y(m)||_x(179);let b=o();b.setFormat(m.getFormatType()),b.setIndent(m.getIndent()),a.push(b),m.remove(!0)}}if(r!==null)for(let g=0;g<a.length;g++){let m=a[g];r.append(m)}let p=null;if(zt(l))if(c)if(r!==null)l.insertAfter(r);else for(let g=a.length-1;g>=0;g--){let m=a[g];l.insertAfter(m)}else{let g=l.getFirstChild();if(Y(g)&&(l=g),g===null)if(r)l.append(r);else for(let m=0;m<a.length;m++){let _=a[m];l.append(_),p=_}else if(r!==null)g.insertBefore(r);else for(let m=0;m<a.length;m++){let _=a[m];g.insertBefore(_),p=_}}else if(r)l.insertAfter(r);else for(let g=a.length-1;g>=0;g--){let m=a[g];l.insertAfter(m),p=m}let h=Kr();B(h)&&FO(h.anchor)&&FO(h.focus)?vt(h.clone()):p!==null?p.selectEnd():t.dirty=!0}function jO(t){let e=t.anchor.getNode(),n=ar(e)?e:e.getParentOrThrow(),o=Os().getElementByKey(n.getKey());if(o===null)return!1;let r=o.ownerDocument.defaultView;return r===null?!1:r.getComputedStyle(o).writingMode==="vertical-rl"}function rj(t,e){let n=jO(t)?!e:e,o=Ni(t.focus,n?"previous":"next");if(uf(o))return!1;for(let r of Xc(o)){if(Oi(r))return!r.origin.isInline();if(!Y(r.origin)){if(Hn(r.origin))return!0;break}}return!1}function VO(t,e,n,o){t.modify(e?"extend":"move",n,o)}function WO(t){let e=t.anchor.getNode();return(ar(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function ij(t,e,n){let o=WO(t),r;r=jO(t)||o?!n:n,VO(t,e,r,"character")}function sj(t,e,n){let o=Nf(t.getStyle());return o!==null&&o[e]||n}function aj(t,e,n=""){let o=null,r=t.getNodes(),i=t.anchor,s=t.focus,a=t.isBackward(),l=a?s.offset:i.offset,c=a?s.getNode():i.getNode();if(B(t)&&t.isCollapsed()&&t.style!==""){let d=Nf(t.style);if(d!==null&&e in d)return d[e]}for(let d=0;d<r.length;d++){let u=r[d];if((d===0||l!==0||!u.is(c))&&te(u)){let p=sj(u,e,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}function mx(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var lj=zO;var Ct=bx,GO=Ct.$addNodeStyle,toe=Ct.$cloneWithProperties,noe=Ct.$copyBlockFormatIndent,ooe=Ct.$ensureForwardRangeSelection,roe=Ct.$forEachSelectedTextNode,ioe=Ct.$getSelectionStyleValueForProperty,yx=Ct.$isAtNodeEnd,YO=Ct.$isParentElementRTL,soe=Ct.$moveCaretSelection,xx=Ct.$moveCharacter,aoe=Ct.$patchStyleText,loe=Ct.$selectAll,Df=Ct.$setBlocksType,vx=Ct.$shouldOverrideDefaultCharacterSelection,Of=Ct.$sliceSelectedTextNodeContent,coe=Ct.$trimTextContentFromAnchor,doe=Ct.$wrapNodes,uoe=Ct.createDOMRange,qO=Ct.createRectsFromDOMRange,poe=Ct.getCSSFromStyleObject,Cx=Ct.getStyleObjectFromCSS,foe=Ct.trimTextContentFromAnchor;var Sx={};$e(Sx,{$descendantsMatching:()=>Gj,$dfs:()=>Oj,$dfsIterator:()=>rI,$filter:()=>Uj,$findMatchingParent:()=>lI,$firstToLastIterator:()=>Yj,$getAdjacentCaret:()=>Ij,$getAdjacentSiblingOrParentSiblingCaret:()=>od,$getDepth:()=>sI,$getNearestBlockElementAncestorOrThrow:()=>Pj,$getNearestNodeOfType:()=>Rj,$getNextRightPreorderNode:()=>Lj,$getNextSiblingOrParentSibling:()=>Mj,$insertFirst:()=>Kj,$insertNodeToNearestRoot:()=>$j,$insertNodeToNearestRootAtCaret:()=>cI,$isEditorIsNestedEditor:()=>Vj,$lastToFirstIterator:()=>Tx,$restoreEditorState:()=>Bj,$reverseDfs:()=>Aj,$reverseDfsIterator:()=>aI,$splitNode:()=>aO,$unwrapAndFilterDescendants:()=>Wj,$unwrapNode:()=>qj,$wrapNodeInElement:()=>zj,CAN_USE_BEFORE_INPUT:()=>yj,CAN_USE_DOM:()=>tI,IS_ANDROID:()=>xj,IS_ANDROID_CHROME:()=>vj,IS_APPLE:()=>Cj,IS_APPLE_WEBKIT:()=>Ej,IS_CHROME:()=>wj,IS_FIREFOX:()=>nI,IS_IOS:()=>Tj,IS_SAFARI:()=>Sj,addClassNamesToElement:()=>kj,calculateZoomLevel:()=>jj,isBlockDomNode:()=>DO,isHTMLAnchorElement:()=>IO,isHTMLElement:()=>Ls,isInlineDomNode:()=>nd,isMimeType:()=>oI,makeStateWrapper:()=>Jj,markSelection:()=>eI,mediaFileReader:()=>Dj,mergeRegister:()=>ZO,objectKlassEquals:()=>Hj,positionNodeOnRange:()=>QO,registerNestedElementResolver:()=>Fj,removeClassNamesFromElement:()=>Nj,selectionAlwaysOnDisplay:()=>bj});function Af(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ho=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,cj=Ho&&"documentMode"in document?document.documentMode:null,dj=Ho&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),uj=Ho&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),pj=!(!Ho||!("InputEvent"in window)||cj)&&"getTargetRanges"in new window.InputEvent("input"),fj=Ho&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),hj=Ho&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,JO=Ho&&/Android/.test(navigator.userAgent),wx=Ho&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gj=Ho&&JO&&wx,mj=Ho&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!wx;function XO(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}function ZO(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function dr(t){return`${t}px`}var _j={attributes:!0,characterData:!0,childList:!0,subtree:!0};function QO(t,e,n){let o=null,r=null,i=null,s=[],a=document.createElement("div");function l(){o===null&&Af(182),r===null&&Af(183);let{left:u,top:p}=r.getBoundingClientRect(),h=qO(t,e);var g,m;a.isConnected||(m=a,(g=r).insertBefore(m,g.firstChild));let _=!1;for(let b=0;b<h.length;b++){let y=h[b],v=s[b]||document.createElement("div"),x=v.style;x.position!=="absolute"&&(x.position="absolute",_=!0);let C=dr(y.left-u);x.left!==C&&(x.left=C,_=!0);let E=dr(y.top-p);x.top!==E&&(v.style.top=E,_=!0);let k=dr(y.width);x.width!==k&&(v.style.width=k,_=!0);let T=dr(y.height);x.height!==T&&(v.style.height=T,_=!0),v.parentNode!==a&&(a.append(v),_=!0),s[b]=v}for(;s.length>h.length;)s.pop();_&&n(s)}function c(){r=null,o=null,i!==null&&i.disconnect(),i=null,a.remove();for(let u of s)u.remove();s=[]}a.style.position="relative";let d=t.registerRootListener((function u(){let p=t.getRootElement();if(p===null)return c();let h=p.parentElement;if(!Ls(h))return c();c(),o=p,r=h,i=new MutationObserver((g=>{let m=t.getRootElement(),_=m&&m.parentElement;if(m!==o||_!==r)return u();for(let b of g)if(!a.contains(b.target))return l()})),i.observe(h,_j),l()}));return()=>{d(),c()}}function If(t,e,n){if(t.type!=="text"&&Y(e)){let o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[SO(n)||n,t.offset]}function eI(t,e){let n=null,o=null,r=null,i=null,s=null,a=null,l=()=>{};function c(d){d.read((()=>{let u=z();if(!B(u))return n=null,r=null,i=null,a=null,l(),void(l=()=>{});let{anchor:p,focus:h}=u,g=p.getNode(),m=g.getKey(),_=p.offset,b=h.getNode(),y=b.getKey(),v=h.offset,x=t.getElementByKey(m),C=t.getElementByKey(y),E=n===null||x!==o||_!==r||m!==n.getKey(),k=i===null||C!==s||v!==a||y!==i.getKey();if((E||k)&&x!==null&&C!==null){let T=(function(w,S,N,D,O,A,I){let R=(w._window?w._window.document:document).createRange();return A.isBefore(N)?(R.setStart(...If(O,A,I)),R.setEnd(...If(S,N,D))):(R.setStart(...If(S,N,D)),R.setEnd(...If(O,A,I))),R})(t,p,g,x,h,b,C);l(),l=QO(t,T,(w=>{if(e===void 0)for(let S of w){let N=S.style;N.background!=="Highlight"&&(N.background="Highlight"),N.color!=="HighlightText"&&(N.color="HighlightText"),N.marginTop!==dr(-1.5)&&(N.marginTop=dr(-1.5)),N.paddingTop!==dr(4)&&(N.paddingTop=dr(4)),N.paddingBottom!==dr(0)&&(N.paddingBottom=dr(0))}else e(w)}))}n=g,o=x,r=_,i=b,s=C,a=v}))}return c(t.getEditorState()),ZO(t.registerUpdateListener((({editorState:d})=>c(d))),(()=>{l()}))}function bj(t){let e=null,n=()=>{let o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();r!==null&&i!==null&&i.contains(r)?e!==null&&(e(),e=null):e===null&&(e=eI(t))};return document.addEventListener("selectionchange",n),()=>{e!==null&&e(),document.removeEventListener("selectionchange",n)}}var yj=pj,tI=Ho,xj=JO,vj=gj,Cj=dj,Ej=mj,wj=wx,nI=uj,Tj=hj,Sj=fj;function kj(t,...e){let n=XO(...e);n.length>0&&t.classList.add(...n)}function Nj(t,...e){let n=XO(...e);n.length>0&&t.classList.remove(...n)}function oI(t,e){for(let n of e)if(t.type.startsWith(n))return!0;return!1}function Dj(t,e){let n=t[Symbol.iterator]();return new Promise(((o,r)=>{let i=[],s=()=>{let{done:a,value:l}=n.next();if(a)return o(i);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",(()=>{let d=c.result;typeof d=="string"&&i.push({file:l,result:d}),s()})),oI(l,e)?c.readAsDataURL(l):s()};s()}))}function Oj(t,e){return Array.from(rI(t,e))}function Ij(t){return t?t.getAdjacentCaret():null}function Aj(t,e){return Array.from(aI(t,e))}function rI(t,e){return iI("next",t,e)}function iI(t,e,n){let o=tt(),r=e||o,i=Y(r)?io(r,t):Nn(r,t),s=sI(r),a=n?Ds(ix(Nn(n,t))):(function(c,d){let u=od(Nn(c,d));return u&&u[0]})(r,t),l=s;return px({hasNext:c=>c!==null,initial:i,map:c=>({depth:l,node:c.origin}),step:c=>{if(c.isSameNodeCaret(a))return null;Oi(c)&&l++;let d=od(c);return!d||d[0].isSameNodeCaret(a)?null:(l+=d[1],d[0])}})}function Mj(t){let e=od(Nn(t,"next"));return e&&[e[0].origin,e[1]]}function sI(t){let e=-1;for(let n=t;n!==null;n=n.getParent())e++;return e}function Lj(t){let e=od(ix(Nn(t,"previous")),"root");return e&&e[0].origin}function aI(t,e){return iI("previous",t,e)}function Rj(t,e){let n=t;for(;n!=null;){if(n instanceof e)return n;n=n.getParent()}return null}function Pj(t){let e=lI(t,(n=>Y(n)&&!n.isInline()));return Y(e)||Af(4,t.__key),e}var lI=(t,e)=>{let n=t;for(;n!==tt()&&n!=null;){if(e(n))return n;n=n.getParent()}return null};function Fj(t,e,n,o){let r=i=>i instanceof e;return t.registerNodeTransform(e,(i=>{let s=(a=>{let l=a.getChildren();for(let u=0;u<l.length;u++){let p=l[u];if(r(p))return null}let c=a,d=a;for(;c!==null;)if(d=c,c=c.getParent(),r(c))return{child:d,parent:c};return null})(i);if(s!==null){let{child:a,parent:l}=s;if(a.is(i)){o(l,i);let c=a.getNextSiblings(),d=c.length;if(l.insertAfter(a),d!==0){let u=n(l);a.insertAfter(u);for(let p=0;p<d;p++)u.append(c[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}}))}function Bj(t,e){let n=new Map,o=t._pendingEditorState;for(let[i,s]of e._nodeMap)n.set(i,Di(s));o&&(o._nodeMap=n),t._dirtyType=2;let r=e._selection;vt(r===null?null:r.clone())}function $j(t){let e=z()||Kr(),n;if(B(e))n=Ni(e.focus,"next");else{if(e!=null){let s=e.getNodes(),a=s[s.length-1];a&&(n=Nn(a,"next"))}n=n||io(tt(),"previous").getFlipped().insert(ge())}let o=cI(t,n),r=Ds(o),i=Oi(r)?lr(r):o;return gf(ZD(i)),t.getLatest()}function cI(t,e,n){let o=rx(e,"next");for(let r=o;r;r=sO(r,n))o=r;return ff(o)&&Af(283),o.insert(t.isInline()?ge().append(t):t),rx(Nn(t.getLatest(),"next"),e.direction)}function zj(t,e){let n=e();return t.replace(n),n.append(t),n}function Hj(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function Uj(t,e){let n=[];for(let o=0;o<t.length;o++){let r=e(t[o]);r!==null&&n.push(r)}return n}function Kj(t,e){io(t,"next").insert(e)}var Ex=!(nI||!tI)&&void 0;function jj(t){let e=1;if((function(){if(Ex===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let o=n.getBoundingClientRect();n.style.setProperty("zoom","2"),Ex=n.getBoundingClientRect().width===o.width,document.body.removeChild(n)}return Ex})())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Vj(t){return t._parentEditor!==null}function Wj(t,e){return dI(t,e,null)}function dI(t,e,n){let o=!1;for(let r of Tx(t))e(r)?n!==null&&n(r):(o=!0,Y(r)&&dI(r,e,n||(i=>r.insertAfter(i))),r.remove());return o}function Gj(t,e){let n=[],o=Array.from(t).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(e(r))n.push(r);else if(Y(r))for(let i of Tx(r))o.push(i);return n}function Yj(t){return uI(io(t,"next"))}function Tx(t){return uI(io(t,"previous"))}function uI(t){return px({hasNext:pf,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function qj(t){rO(Nn(t,"next")).splice(1,t.getChildren())}function od(t,e="root"){let n=0,o=t,r=Ds(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=Ds(o)}return r&&[r,n]}function Jj(t){let e=o=>QD(o,t),n=(o,r)=>iO(o,t,r);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:t}}var me=Sx,kx=me.$descendantsMatching,pI=me.$dfs,boe=me.$dfsIterator,fI=me.$filter,ue=me.$findMatchingParent,yoe=me.$firstToLastIterator,hI=me.$getAdjacentCaret,xoe=me.$getAdjacentSiblingOrParentSiblingCaret,voe=me.$getDepth,Rs=me.$getNearestBlockElementAncestorOrThrow,Mf=me.$getNearestNodeOfType,Coe=me.$getNextRightPreorderNode,Eoe=me.$getNextSiblingOrParentSibling,gI=me.$insertFirst,Lf=me.$insertNodeToNearestRoot,woe=me.$insertNodeToNearestRootAtCaret,mI=me.$isEditorIsNestedEditor,Toe=me.$lastToFirstIterator,Soe=me.$restoreEditorState,koe=me.$reverseDfs,Noe=me.$reverseDfsIterator,Doe=me.$splitNode,Nx=me.$unwrapAndFilterDescendants,Ooe=me.$unwrapNode,Ioe=me.$wrapNodeInElement,Aoe=me.CAN_USE_BEFORE_INPUT,Moe=me.CAN_USE_DOM,Loe=me.IS_ANDROID,Roe=me.IS_ANDROID_CHROME,Dt=me.IS_APPLE,Poe=me.IS_APPLE_WEBKIT,Foe=me.IS_CHROME,Boe=me.IS_FIREFOX,$oe=me.IS_IOS,zoe=me.IS_SAFARI,Ye=me.addClassNamesToElement,_I=me.calculateZoomLevel,Dx=me.isBlockDomNode,Ox=me.isHTMLAnchorElement,en=me.isHTMLElement,Hoe=me.isInlineDomNode,Uoe=me.isMimeType,Koe=me.makeStateWrapper,joe=me.markSelection,Voe=me.mediaFileReader,He=me.mergeRegister,ao=me.objectKlassEquals,Woe=me.positionNodeOnRange,Goe=me.registerNestedElementResolver,Wn=me.removeClassNamesFromElement,Yoe=me.selectionAlwaysOnDisplay;var Mx={};$e(Mx,{$createAutoLinkNode:()=>Ix,$createLinkNode:()=>sl,$isAutoLinkNode:()=>rd,$isLinkNode:()=>Bi,$toggleLink:()=>xI,AutoLinkNode:()=>id,LinkNode:()=>il,TOGGLE_LINK_COMMAND:()=>Qj,formatUrl:()=>Ax,toggleLink:()=>eV});var Xj=new Set(["http:","https:","mailto:","sms:","tel:"]),il=class t extends Ht{static getType(){return"link"}static clone(e){return new t(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",n={},o){super(o);let{target:r=null,rel:i=null,title:s=null}=n;this.__url=e,this.__target=r,this.__rel=i,this.__title=s}createDOM(e){let n=document.createElement("a");return this.updateLinkDOM(null,n,e),Ye(n,e.theme.link),n}updateLinkDOM(e,n,o){if(Ox(n)){e&&e.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(let r of["target","rel","title"]){let i=`__${r}`,s=this[i];e&&e[i]===s||(s?n[r]=s:n.removeAttribute(r))}}}updateDOM(e,n,o){return this.updateLinkDOM(e,n,o),!1}static importDOM(){return{a:e=>({conversion:Zj,priority:1})}}static importJSON(e){return sl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Ax(e);try{let n=new URL(Ax(e));if(!Xj.has(n.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let n=this.getWritable();return n.__url=e,n}getTarget(){return this.getLatest().__target}setTarget(e){let n=this.getWritable();return n.__target=e,n}getRel(){return this.getLatest().__rel}setRel(e){let n=this.getWritable();return n.__rel=e,n}getTitle(){return this.getLatest().__title}setTitle(e){let n=this.getWritable();return n.__title=e,n}insertNewAfter(e,n=!0){let o=sl(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,n),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,o){if(!B(n))return!1;let r=n.anchor.getNode(),i=n.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&n.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function Zj(t){let e=null;if(Ox(t)){let n=t.textContent;(n!==null&&n!==""||t.children.length>0)&&(e=sl(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function sl(t="",e){return At(new il(t,e))}function Bi(t){return t instanceof il}var id=class t extends il{constructor(e="",n={},o){super(e,n,o),this.__isUnlinked=n.isUnlinked!==void 0&&n.isUnlinked!==null&&n.isUnlinked}static getType(){return"autolink"}static clone(e){return new t(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let n=this.getWritable();return n.__isUnlinked=e,n}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,n,o){return super.updateDOM(e,n,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Ix().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,n=!0){let o=this.getParentOrThrow().insertNewAfter(e,n);if(Y(o)){let r=Ix(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(r),r}return null}};function Ix(t="",e){return At(new id(t,e))}function rd(t){return t instanceof id}var Qj=jn("TOGGLE_LINK_COMMAND");function bI(t,e){if(t.type==="element"){let n=t.getNode();return Y(n)||(function(o,...r){let i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",o);for(let a of r)s.append("v",a);throw i.search=s.toString(),Error(`Minified Lexical error #${o}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),n.getChildren()[t.offset+e]||null}return null}function xI(t,e={}){let{target:n,title:o}=e,r=e.rel===void 0?"noreferrer":e.rel,i=z();if(i===null||!B(i)&&!gt(i))return;if(gt(i)){let c=i.getNodes();return c.length===0?void 0:void c.forEach((d=>{if(t===null){let u=ue(d,(p=>!rd(p)&&Bi(p)));u&&(u.insertBefore(d),u.getChildren().length===0&&u.remove())}else{let u=ue(d,(p=>!rd(p)&&Bi(p)));if(u)u.setURL(t),n!==void 0&&u.setTarget(n),r!==void 0&&u.setRel(r);else{let p=sl(t,{rel:r,target:n});d.insertBefore(p),p.append(d)}}}))}let s=i.extract();if(t===null)return void s.forEach((c=>{let d=ue(c,(u=>!rd(u)&&Bi(u)));if(d){let u=d.getChildren();for(let p=0;p<u.length;p++)d.insertBefore(u[p]);d.remove()}}));let a=new Set,l=c=>{a.has(c.getKey())||(a.add(c.getKey()),c.setURL(t),n!==void 0&&c.setTarget(n),r!==void 0&&c.setRel(r),o!==void 0&&c.setTitle(o))};if(s.length===1){let c=yI(s[0],Bi);if(c!==null)return l(c)}(function(c){let d=z();if(!B(d))return c();let u=jr(d),p=u.isBackward(),h=bI(u.anchor,p?-1:0),g=bI(u.focus,p?0:-1),m=c();if(h||g){let _=z();if(B(_)){let b=_.clone();if(h){let y=h.getParent();y&&b.anchor.set(y.getKey(),h.getIndexWithinParent()+(p?1:0),"element")}if(g){let y=g.getParent();y&&b.focus.set(y.getKey(),g.getIndexWithinParent()+(p?0:1),"element")}vt(jr(b))}}})((()=>{let c=null;for(let d of s){if(!d.isAttached())continue;let u=yI(d,Bi);if(u){l(u);continue}if(Y(d)){if(!d.isInline())continue;if(Bi(d)){if(!(rd(d)||c!==null&&c.getParentOrThrow().isParentOf(d))){l(d),c=d;continue}for(let h of d.getChildren())d.insertBefore(h);d.remove();continue}}let p=d.getPreviousSibling();Bi(p)&&p.is(c)?p.append(d):(c=sl(t,{rel:r,target:n,title:o}),d.insertAfter(c),c.append(d))}}))}var eV=xI;function yI(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var tV=/^\+?[0-9\s()-]{5,}$/;function Ax(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:tV.test(t)?`tel:${t}`:`https://${t}`}var ur=Mx,Zoe=ur.$createAutoLinkNode,Rf=ur.$createLinkNode,sd=ur.$isAutoLinkNode,Qe=ur.$isLinkNode,Pf=ur.$toggleLink,vI=ur.AutoLinkNode,al=ur.LinkNode,Gn=ur.TOGGLE_LINK_COMMAND,Qoe=ur.formatUrl,ere=ur.toggleLink;var Bx={};$e(Bx,{$createListItemNode:()=>lo,$createListNode:()=>Yn,$getListDepth:()=>Ff,$handleListInsertParagraph:()=>AI,$insertList:()=>ad,$isListItemNode:()=>Me,$isListNode:()=>Oe,$removeList:()=>Fx,INSERT_CHECK_LIST_COMMAND:()=>MI,INSERT_ORDERED_LIST_COMMAND:()=>FI,INSERT_UNORDERED_LIST_COMMAND:()=>PI,ListItemNode:()=>Fs,ListNode:()=>ll,REMOVE_LIST_COMMAND:()=>BI,UPDATE_LIST_START_COMMAND:()=>RI,insertList:()=>uV,registerCheckList:()=>lV,registerList:()=>cV,registerListStrictIndentTransform:()=>dV,removeList:()=>pV});function $i(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ff(t){let e=1,n=t.getParent();for(;n!=null;){if(Me(n)){let o=n.getParent();if(Oe(o)){e++,n=o.getParent();continue}$i(40)}return e}return e}function Lx(t){let e=t.getParent();Oe(e)||$i(40);let n=e;for(;n!==null;)n=n.getParent(),Oe(n)&&(e=n);return e}function DI(t){let e=[],n=t.getChildren().filter(Me);for(let o=0;o<n.length;o++){let r=n[o],i=r.getFirstChild();Oe(i)?e=e.concat(DI(i)):e.push(r)}return e}function pr(t){return Me(t)&&Oe(t.getFirstChild())}function CI(t){return lo().append(t)}function OI(t,e){return Me(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function ad(t){let e=z();if(e!==null){let n=e.getNodes();if(B(e)){let r=e.getStartEndPoints();r===null&&$i(143);let[i]=r,s=i.getNode(),a=s.getParent();if(zt(s)){let l=s.getFirstChild();if(l)n=l.selectStart().getNodes();else{let c=ge();s.append(c),n=c.select().getNodes()}}else if(OI(s,n)){let l=Yn(t);if(zt(a)){s.replace(l);let c=lo();Y(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),l.append(c)}else if(Me(s)){let c=s.getParentOrThrow();Ps(l,c.getChildren()),c.replace(l)}return}}let o=new Set;for(let r=0;r<n.length;r++){let i=n[r];if(Y(i)&&i.isEmpty()&&!Me(i)&&!o.has(i.getKey())){EI(i,t);continue}let s=Zc(i)?i.getParent():Me(i)&&i.isEmpty()?i:null;for(;s!=null;){let a=s.getKey();if(Oe(s)){if(!o.has(a)){let l=Yn(t);Ps(l,s.getChildren()),s.replace(l),o.add(a)}break}{let l=s.getParent();if(zt(l)&&!o.has(a)){o.add(a),EI(s,t);break}s=l}}}}}function Ps(t,e){t.splice(t.getChildrenSize(),0,e)}function EI(t,e){if(Oe(t))return t;let n=t.getPreviousSibling(),o=t.getNextSibling(),r=lo(),i;if(Ps(r,t.getChildren()),Oe(n)&&e===n.getListType())n.append(r),Oe(o)&&e===o.getListType()&&(Ps(n,o.getChildren()),o.remove()),i=n;else if(Oe(o)&&e===o.getListType())o.getFirstChildOrThrow().insertBefore(r),i=o;else{let s=Yn(e);s.append(r),t.replace(s),i=s}return r.setFormat(t.getFormatType()),r.setIndent(t.getIndent()),t.remove(),i}function Px(t,e){let n=t.getLastChild(),o=e.getFirstChild();n&&o&&pr(n)&&pr(o)&&(Px(n.getFirstChild(),o.getFirstChild()),o.remove());let r=e.getChildren();r.length>0&&t.append(...r),e.remove()}function Fx(){let t=z();if(B(t)){let e=new Set,n=t.getNodes(),o=t.anchor.getNode();if(OI(o,n))e.add(Lx(o));else for(let r=0;r<n.length;r++){let i=n[r];if(Zc(i)){let s=Mf(i,Fs);s!=null&&e.add(Lx(s))}}for(let r of e){let i=r,s=DI(r);for(let a of s){let l=ge().setTextStyle(t.style).setTextFormat(t.format);Ps(l,a.getChildren()),i.insertAfter(l),i=l,a.__key===t.anchor.key&&Ii(t.anchor,lr(io(l,"next"))),a.__key===t.focus.key&&Ii(t.focus,lr(io(l,"next"))),a.remove()}r.remove()}}}function II(t){let e=t.getListType()!=="check",n=t.getStart();for(let o of t.getChildren())Me(o)&&(o.getValue()!==n&&o.setValue(n),e&&o.getLatest().__checked!=null&&o.setChecked(void 0),Oe(o.getFirstChild())||n++)}function nV(t){let e=new Set;if(pr(t)||e.has(t.getKey()))return;let n=t.getParent(),o=t.getNextSibling(),r=t.getPreviousSibling();if(pr(o)&&pr(r)){let i=r.getFirstChild();if(Oe(i)){i.append(t);let s=o.getFirstChild();Oe(s)&&(Ps(i,s.getChildren()),o.remove(),e.add(o.getKey()))}}else if(pr(o)){let i=o.getFirstChild();if(Oe(i)){let s=i.getFirstChild();s!==null&&s.insertBefore(t)}}else if(pr(r)){let i=r.getFirstChild();Oe(i)&&i.append(t)}else if(Oe(n)){let i=lo().setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle()),s=Yn(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());i.append(s),s.append(t),r?r.insertAfter(i):o?o.insertBefore(i):n.append(i)}}function oV(t){if(pr(t))return;let e=t.getParent(),n=e?e.getParent():void 0;if(Oe(n?n.getParent():void 0)&&Me(n)&&Oe(e)){let o=e?e.getFirstChild():void 0,r=e?e.getLastChild():void 0;if(t.is(o))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(r))n.insertAfter(t),e.isEmpty()&&n.remove();else{let i=e.getListType(),s=lo(),a=Yn(i);s.append(a),t.getPreviousSiblings().forEach((d=>a.append(d)));let l=lo(),c=Yn(i);l.append(c),Ps(c,t.getNextSiblings()),n.insertBefore(s),n.insertAfter(l),n.replace(t)}}}function AI(){let t=z();if(!B(t)||!t.isCollapsed())return!1;let e=t.anchor.getNode();if(!Me(e)||e.getChildrenSize()!==0)return!1;let n=Lx(e),o=e.getParent();Oe(o)||$i(40);let r=o.getParent(),i;if(zt(r))i=ge(),n.insertAfter(i);else{if(!Me(r))return!1;i=lo(),r.insertAfter(i)}i.setTextStyle(t.style).setTextFormat(t.format).select();let s=e.getNextSiblings();if(s.length>0){let a=Yn(o.getListType());if(Me(i)){let l=lo();l.append(a),i.insertAfter(l)}else i.insertAfter(a);a.append(...s)}return(function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){let c=l.getParent();if(c==null||!Me(c)&&!Oe(c))break;l=c}l.remove()})(e),!0}function Bf(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var Fs=class extends Ht{$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;let n=e.getParent();Oe(n)&&n.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:Ht,importDOM:dx({li:()=>({conversion:rV,priority:0})})})}constructor(e=1,n=void 0,o){super(o),this.__value=e===void 0?1:e,this.__checked=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let n=document.createElement("li");return this.updateListItemDOM(null,n,e),n}updateListItemDOM(e,n,o){let r=this.getParent();Oe(r)&&r.getListType()==="check"&&(function(a,l,c,d){Oe(l.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&l.__checked===c.__checked||a.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(n,this,e),n.value=this.__value,(function(a,l,c){let d=[],u=[],p=l.list,h=p?p.listitem:void 0,g;if(p&&p.nested&&(g=p.nested.listitem),h!==void 0&&d.push(...Bf(h)),p){let m=c.getParent(),_=Oe(m)&&m.getListType()==="check",b=c.getChecked();_&&!b||u.push(p.listitemUnchecked),_&&b||u.push(p.listitemChecked),_&&d.push(b?p.listitemChecked:p.listitemUnchecked)}if(g!==void 0){let m=Bf(g);c.getChildren().some((_=>Oe(_)))?d.push(...m):u.push(...m)}u.length>0&&Wn(a,...u),d.length>0&&Ye(a,...d)})(n,o.theme,this);let i=e?e.__style:"",s=this.__style;i!==s&&(s===""?n.removeAttribute("style"):n.style.cssText=s),(function(a,l,c){let d=Cx(l.__textStyle);for(let u in d)a.style.setProperty(`--listitem-marker-${u}`,d[u]);if(c)for(let u in Cx(c.__textStyle))u in d||a.style.removeProperty(`--listitem-marker-${u}`)})(n,this,e)}updateDOM(e,n,o){let r=n;return this.updateListItemDOM(e,r,o),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let n=this.createDOM(e._config),o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();return r&&(n.dir=r),{element:n}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let n=0;n<e.length;n++){let o=e[n];if(Y(o)&&this.canMergeWith(o)){let r=o.getChildren();this.append(...r),o.remove()}else super.append(o)}return this}replace(e,n){if(Me(e))return super.replace(e);this.setIndent(0);let o=this.getParentOrThrow();if(!Oe(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{let r=Yn(o.getListType()),i=this.getNextSibling();for(;i;){let s=i;i=i.getNextSibling(),r.append(s)}o.insertAfter(e),e.insertAfter(r)}return n&&(Y(e)||$i(139),this.getChildren().forEach((r=>{e.append(r)}))),this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,n=!0){let o=this.getParentOrThrow();if(Oe(o)||$i(39),Me(e))return super.insertAfter(e,n);let r=this.getNextSiblings();if(o.insertAfter(e,n),r.length!==0){let i=Yn(o.getListType());r.forEach((s=>i.append(s))),e.insertAfter(i,n)}return e}remove(e){let n=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),n&&o&&pr(n)&&pr(o)&&(Px(n.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(e,n=!0){let o=lo().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,n),o}collapseAtStart(e){let n=ge();this.getChildren().forEach((s=>n.append(s)));let o=this.getParentOrThrow(),r=o.getParentOrThrow(),i=Me(r);if(o.getChildrenSize()===1)if(i)o.remove(),r.select();else{o.insertBefore(n),o.remove();let s=e.anchor,a=e.focus,l=n.getKey();s.type==="element"&&s.getNode().is(this)&&s.set(l,s.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else o.insertBefore(n),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let n=this.getWritable();return n.__value=e,n}getChecked(){let e=this.getLatest(),n,o=this.getParent();return Oe(o)&&(n=o.getListType()),n==="check"?!!e.__checked:void 0}setChecked(e){let n=this.getWritable();return n.__checked=e,n}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let n=e.getParentOrThrow(),o=0;for(;Me(n);)n=n.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){typeof e!="number"&&$i(117),(e=Math.floor(e))>=0||$i(199);let n=this.getIndent();for(;n!==e;)n<e?(nV(this),n++):(oV(this),n--);return this}canInsertAfter(e){return Me(e)}canReplaceWith(e){return Me(e)}canMergeWith(e){return Me(e)||Qt(e)}extractWithChild(e,n){if(!B(n))return!1;let o=n.anchor.getNode(),r=n.focus.getNode();return this.isParentOf(o)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Yn("bullet")}canMergeWhenEmpty(){return!0}};function rV(t){if(t.classList.contains("task-list-item")){for(let n of t.children)if(n.tagName==="INPUT")return iV(n)}let e=t.getAttribute("aria-checked");return{node:lo(e==="true"||e!=="false"&&void 0)}}function iV(t){return t.getAttribute("type")!=="checkbox"?{node:null}:{node:lo(t.hasAttribute("checked"))}}function lo(t){return At(new Fs(void 0,t))}function Me(t){return t instanceof Fs}var ll=class extends Ht{$config(){return this.config("list",{$transform:e=>{(function(n){let o=n.getNextSibling();Oe(o)&&n.getListType()===o.getListType()&&Px(n,o)})(e),II(e)},extends:Ht,importDOM:dx({ol:()=>({conversion:TI,priority:0}),ul:()=>({conversion:TI,priority:0})})})}constructor(e="number",n=1,o){super(o);let r=aV[e]||e;this.__listType=r,this.__tag=r==="number"?"ol":"ul",this.__start=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let n=this.getWritable();return n.__listType=e,n.__tag=e==="number"?"ol":"ul",n}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let n=this.getWritable();return n.__start=e,n}createDOM(e,n){let o=this.__tag,r=document.createElement(o);return this.__start!==1&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,wI(r,e.theme,this),r}updateDOM(e,n,o){return e.__tag!==this.__tag||(wI(n,o.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let n=this.createDOM(e._config,e);return en(n)&&(this.__start!==1&&n.setAttribute("start",String(this.__start)),this.__listType==="check"&&n.setAttribute("__lexicalListType","check")),{element:n}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,n,o){let r=o;for(let i=0;i<o.length;i++){let s=o[i];Me(s)||(r===o&&(r=[...o]),r[i]=lo().append(!Y(s)||Oe(s)||s.isInline()?s:kt(s.getTextContent())))}return super.splice(e,n,r)}extractWithChild(e){return Me(e)}};function wI(t,e,n){let o=[],r=[],i=e.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[],a=Ff(n)-1,l=a%s.length,c=s[l],d=i[n.__tag],u,p=i.nested,h=i.checklist;if(p!==void 0&&p.list&&(u=p.list),d!==void 0&&o.push(d),h!==void 0&&n.__listType==="check"&&o.push(h),c!==void 0){o.push(...Bf(c));for(let g=0;g<s.length;g++)g!==l&&r.push(n.__tag+g)}if(u!==void 0){let g=Bf(u);a>1?o.push(...g):r.push(...g)}}r.length>0&&Wn(t,...r),o.length>0&&Ye(t,...o)}function sV(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];if(Me(o)){e.push(o);let r=o.getChildren();r.length>1&&r.forEach((i=>{Oe(i)&&e.push(CI(i))}))}else e.push(CI(o))}return e}function TI(t){let e=t.nodeName.toLowerCase(),n=null;return e==="ol"?n=Yn("number",t.start):e==="ul"&&(n=(function(o){if(o.getAttribute("__lexicallisttype")==="check"||o.classList.contains("contains-task-list"))return!0;for(let r of o.childNodes)if(en(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(t)?Yn("check"):Yn("bullet")),{after:sV,node:n}}var aV={ol:"number",ul:"bullet"};function Yn(t="number",e=1){return At(new ll(t,e))}function Oe(t){return t instanceof ll}var MI=jn("INSERT_CHECK_LIST_COMMAND");function lV(t){return He(t.registerCommand(MI,(()=>(ad("check"),!0)),Re),t.registerCommand(Vr,(e=>NI(e,t,!1)),Re),t.registerCommand(zo,(e=>NI(e,t,!0)),Re),t.registerCommand(Li,(()=>{if(Rx()!=null){let e=t.getRootElement();return e?.focus(),!0}return!1}),Re),t.registerCommand(Tf,(e=>{let n=Rx();return!(n==null||!t.isEditable())&&(t.update((()=>{let o=ln(n);Me(o)&&(e.preventDefault(),o.toggleChecked())})),!0)}),Re),t.registerCommand(rl,(e=>t.getEditorState().read((()=>{let n=z();if(B(n)&&n.isCollapsed()){let{anchor:o}=n,r=o.type==="element";if(r||o.offset===0){let i=o.getNode(),s=ue(i,(a=>Y(a)&&!a.isInline()));if(Me(s)){let a=s.getParent();if(Oe(a)&&a.getListType()==="check"&&(r||s.getFirstDescendant()===i)){let l=t.getElementByKey(s.__key);if(l!=null&&document.activeElement!==l)return l.focus(),e.preventDefault(),!0}}}}return!1}))),Re),t.registerRootListener(((e,n)=>{e!==null&&(e.addEventListener("click",SI),e.addEventListener("pointerdown",kI)),n!==null&&(n.removeEventListener("click",SI),n.removeEventListener("pointerdown",kI))})))}function LI(t,e){let n=t.target;if(!en(n))return;let o=n.firstChild;if(en(o)&&(o.tagName==="UL"||o.tagName==="OL"))return;let r=n.parentNode;if(!r||r.__lexicalListType!=="check")return;let i=n.getBoundingClientRect(),s=_I(n),a=t.clientX/s,l=window.getComputedStyle?window.getComputedStyle(n,"::before"):{width:"0px"},c=parseFloat(l.width),d=t.pointerType==="touch"?32:0;(n.dir==="rtl"?a<i.right+d&&a>i.right-c-d:a>i.left-d&&a<i.left+c+d)&&e()}function SI(t){LI(t,(()=>{if(en(t.target)){let e=t.target,n=kO(e);n!=null&&n.isEditable()&&n.update((()=>{let o=ln(e);Me(o)&&(e.focus(),o.toggleChecked())}))}}))}function kI(t){LI(t,(()=>{t.preventDefault()}))}function Rx(){let t=document.activeElement;return en(t)&&t.tagName==="LI"&&t.parentNode!=null&&t.parentNode.__lexicalListType==="check"?t:null}function NI(t,e,n){let o=Rx();return o!=null&&e.update((()=>{let r=ln(o);if(!Me(r))return;let i=(function(s,a){let l=a?s.getPreviousSibling():s.getNextSibling(),c=s;for(;l==null&&Me(c);)c=c.getParentOrThrow().getParent(),c!=null&&(l=a?c.getPreviousSibling():c.getNextSibling());for(;Me(l);){let d=a?l.getLastChild():l.getFirstChild();if(!Oe(d))return l;l=a?d.getLastChild():d.getFirstChild()}return null})(r,n);if(i!=null){i.selectStart();let s=e.getElementByKey(i.__key);s!=null&&(t.preventDefault(),setTimeout((()=>{s.focus()}),0))}})),!1}var RI=jn("UPDATE_LIST_START_COMMAND"),PI=jn("INSERT_UNORDERED_LIST_COMMAND"),FI=jn("INSERT_ORDERED_LIST_COMMAND"),BI=jn("REMOVE_LIST_COMMAND");function cV(t){return He(t.registerCommand(FI,(()=>(ad("number"),!0)),Re),t.registerCommand(RI,(e=>{let{listNodeKey:n,newStart:o}=e,r=Mt(n);return!!Oe(r)&&(r.getListType()==="number"&&(r.setStart(o),II(r)),!0)}),Re),t.registerCommand(PI,(()=>(ad("bullet"),!0)),Re),t.registerCommand(BI,(()=>(Fx(),!0)),Re),t.registerCommand(Mi,(()=>AI()),Re),t.registerNodeTransform(Fs,(e=>{let n=e.getFirstChild();if(n){if(te(n)){let o=n.getStyle(),r=n.getFormat();e.getTextStyle()!==o&&e.setTextStyle(o),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let o=z();B(o)&&(o.style!==e.getTextStyle()||o.format!==e.getTextFormat())&&o.isCollapsed()&&e.is(o.anchor.getNode())&&e.setTextStyle(o.style).setTextFormat(o.format)}})),t.registerNodeTransform(Ut,(e=>{let n=e.getParent();if(Me(n)&&e.is(n.getFirstChild())){let o=e.getStyle(),r=e.getFormat();o===n.getTextStyle()&&r===n.getTextFormat()||n.setTextStyle(o).setTextFormat(r)}})))}function dV(t){let e=n=>{let o=n.getParent();if(Oe(n.getFirstChild())||!Oe(o))return;let r=ue(n,(i=>Me(i)&&Oe(i.getParent())&&Me(i.getPreviousSibling())));if(r===null&&n.getIndent()>0)n.setIndent(0);else if(Me(r)){let i=r.getPreviousSibling();if(Me(i)){let s=(function(l){let c=l,d=c.getFirstChild();for(;Oe(d);){let u=d.getLastChild();if(!Me(u))break;c=u,d=c.getFirstChild()}return c})(i),a=s.getParent();if(Oe(a)){let l=Ff(a);l+1<Ff(o)&&n.setIndent(l)}}}};return t.registerNodeTransform(ll,(n=>{let o=[n];for(;o.length>0;){let r=o.shift();if(Oe(r)){for(let i of r.getChildren())if(Me(i)){e(i);let s=i.getFirstChild();Oe(s)&&o.push(s)}}}}))}function uV(t,e){t.update((()=>ad(e)))}function pV(t){t.update((()=>Fx()))}var Lt=Bx,ld=Lt.$createListItemNode,cl=Lt.$createListNode,ire=Lt.$getListDepth,sre=Lt.$handleListInsertParagraph,are=Lt.$insertList,cd=Lt.$isListItemNode,Dn=Lt.$isListNode,lre=Lt.$removeList,cre=Lt.INSERT_CHECK_LIST_COMMAND,$I=Lt.INSERT_ORDERED_LIST_COMMAND,zI=Lt.INSERT_UNORDERED_LIST_COMMAND,zi=Lt.ListItemNode,fr=Lt.ListNode,dre=Lt.REMOVE_LIST_COMMAND,ure=Lt.UPDATE_LIST_START_COMMAND,pre=Lt.insertList,fre=Lt.registerCheckList,HI=Lt.registerList,UI=Lt.registerListStrictIndentTransform,hre=Lt.removeList;var $x={};$e($x,{LexicalComposerContext:()=>KI,createLexicalComposerContext:()=>fV,useLexicalComposerContext:()=>hV});bt();var KI=pt(null);function fV(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}}function hV(){let t=ft(KI);return t==null&&(function(e,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(let i of n)r.append("v",i);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),t}var zx=$x,jI=zx.LexicalComposerContext,VI=zx.createLexicalComposerContext,ve=zx.useLexicalComposerContext;var Hx={};$e(Hx,{AutoFocusPlugin:()=>gV});bt();function gV({defaultSelection:t}){let[e]=ve();return F((()=>{e.focus((()=>{let n=document.activeElement,o=e.getRootElement();o===null||n!==null&&o.contains(n)||o.focus({preventScroll:!0})}),{defaultSelection:t})}),[t,e]),null}var mV=Hx,WI=mV.AutoFocusPlugin;var Ux={};$e(Ux,{LexicalComposer:()=>bV});bt();var GI=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_V=GI?_n:F,$f={tag:ol};function bV({initialConfig:t,children:e}){let n=X((()=>{let{theme:o,namespace:r,nodes:i,onError:s,editorState:a,html:l}=t,c=VI(null,o),d=TO({editable:t.editable,html:l,namespace:r,nodes:i,onError:u=>s(u,d),theme:o});return(function(u,p){if(p!==null){if(p===void 0)u.update((()=>{let h=tt();if(h.isEmpty()){let g=ge();h.append(g);let m=GI?document.activeElement:null;(z()!==null||m!==null&&m===u.getRootElement())&&g.select()}}),$f);else if(p!==null)switch(typeof p){case"string":{let h=u.parseEditorState(p);u.setEditorState(h,$f);break}case"object":u.setEditorState(p,$f);break;case"function":u.update((()=>{tt().isEmpty()&&p(u)}),$f)}}})(d,a),[d,c]}),[]);return _V((()=>{let o=t.editable,[r]=n;r.setEditable(o===void 0||o)}),[]),f(jI.Provider,{value:n,children:e})}var yV=Ux,YI=yV.LexicalComposer;var jx={};$e(jx,{$canShowPlaceholder:()=>JI,$canShowPlaceholderCurry:()=>vV,$findTextIntersectionFromCharacters:()=>CV,$isRootTextContentEmpty:()=>Kx,$isRootTextContentEmptyCurry:()=>xV,$rootTextContent:()=>qI,registerLexicalTextEntity:()=>wV});function qI(){return tt().getTextContent()}function Kx(t,e=!0){if(t)return!1;let n=qI();return e&&(n=n.trim()),n===""}function xV(t,e){return()=>Kx(t,e)}function JI(t){if(!Kx(t,!1))return!1;let e=tt().getChildren(),n=e.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=e[o];if(Hn(r))return!1;if(Y(r)){if(!Qt(r)||r.__indent!==0)return!1;let i=r.getChildren(),s=i.length;for(let a=0;a<s;a++){let l=i[o];if(!te(l))return!1}}}return!0}function vV(t){return()=>JI(t)}function CV(t,e){let n=t.getFirstChild(),o=0;e:for(;n!==null;){if(Y(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(te(n)){let s=n.getTextContentSize();if(o+s>e)return{node:n,offset:e-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let i=n.getParent();for(;i!==null;){let s=i.getNextSibling();if(s!==null){n=s;continue e}i=i.getParent()}break}return null}function EV(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function wV(t,e,n,o){let r=s=>s instanceof n,i=s=>{let a=kt(s.getTextContent());a.setFormat(s.getFormat()),s.replace(a)};return[t.registerNodeTransform(Ut,(s=>{if(!s.isSimpleText())return;let a,l=s.getPreviousSibling(),c=s.getTextContent(),d=s;if(te(l)){let p=l.getTextContent(),h=e(p+c);if(r(l)){if(h===null||(g=>g.getLatest().__mode)(l)!==0)return void i(l);{let g=h.end-p.length;if(g>0){let m=p+c.slice(0,g);if(l.select(),l.setTextContent(m),g===c.length)s.remove();else{let _=c.slice(g);s.setTextContent(_)}return}}}else if(h===null||h.start<p.length)return}let u=0;for(;;){a=e(c);let p,h=a===null?"":c.slice(a.end);if(c=h,h===""){let m=d.getNextSibling();if(te(m)){h=d.getTextContent()+m.getTextContent();let _=e(h);if(_===null)return void(r(m)?i(m):m.markDirty());if(_.start!==0)return}}if(a===null)return;if(a.start===0&&te(l)&&l.isTextEntity()){u+=a.end;continue}a.start===0?[p,d]=d.splitText(a.end):[,p,d]=d.splitText(a.start+u,a.end+u),p===void 0&&EV(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),d==null)return;u=0,l=g}})),t.registerNodeTransform(n,(s=>{let a=s.getTextContent(),l=e(a);if(l===null||l.start!==0)return void i(s);if(a.length>l.end)return void s.splitText(l.end);let c=s.getPreviousSibling();te(c)&&c.isTextEntity()&&(i(c),i(s));let d=s.getNextSibling();te(d)&&d.isTextEntity()&&(i(d),r(s)&&i(s))}))]}var Bs=jx,Dre=Bs.$canShowPlaceholder,zf=Bs.$canShowPlaceholderCurry,Ore=Bs.$findTextIntersectionFromCharacters,Ire=Bs.$isRootTextContentEmpty,Are=Bs.$isRootTextContentEmptyCurry,Mre=Bs.$rootTextContent,Lre=Bs.registerLexicalTextEntity;var Vx={};$e(Vx,{ContentEditable:()=>SV,ContentEditableElement:()=>QI});bt();var ZI=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?_n:F;function TV({editor:t,ariaActiveDescendant:e,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:c,ariaMultiline:d,ariaOwns:u,ariaRequired:p,autoCapitalize:h,className:g,id:m,role:_="textbox",spellCheck:b=!0,style:y,tabIndex:v,"data-testid":x,...C},E){let[k,T]=L(t.isEditable()),w=Ne((N=>{N&&N.ownerDocument&&N.ownerDocument.defaultView?t.setRootElement(N):t.setRootElement(null)}),[t]),S=X((()=>(function(...N){return D=>{N.forEach((O=>{typeof O=="function"?O(D):O!=null&&(O.current=D)}))}})(E,w)),[w,E]);return ZI((()=>(T(t.isEditable()),t.registerEditableListener((N=>{T(N)})))),[t]),f("div",{"aria-activedescendant":k?e:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":k&&_==="combobox"?!!s:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":c,"aria-multiline":d,"aria-owns":k?u:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:h,className:g,contentEditable:k,"data-testid":x,id:m,ref:S,role:_,spellCheck:b,style:y,tabIndex:v,...C})}var QI=Go(TV);function XI(t){return t.getEditorState().read(zf(t.isComposing()))}var SV=Go(kV);function kV(t,e){let{placeholder:n,...o}=t,[r]=ve();return f(ke,{children:[f(QI,{editor:r,...o,ref:e}),n!=null&&f(NV,{editor:r,content:n})]})}function NV({content:t,editor:e}){let n=(function(s){let[a,l]=L((()=>XI(s)));return ZI((()=>{function c(){let d=XI(s);l(d)}return c(),He(s.registerUpdateListener((()=>{c()})),s.registerEditableListener((()=>{c()})))}),[s]),a})(e),[o,r]=L(e.isEditable());if(_n((()=>(r(e.isEditable()),e.registerEditableListener((s=>{r(s)})))),[e]),!n)return null;let i=null;return typeof t=="function"?i=t(o):t!==null&&(i=t),i===null?null:f("div",{"aria-hidden":!0,children:i})}var eA=Vx,tA=eA.ContentEditable,Hre=eA.ContentEditableElement;var Gx={};$e(Gx,{LexicalErrorBoundary:()=>OV});bt();function Wx(t,e){return Wx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Wx(t,e)}var nA={error:null},DV=(function(t){var e,n;function o(){for(var i,s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return(i=t.call.apply(t,[this].concat(a))||this).state=nA,i.resetErrorBoundary=function(){for(var c,d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];i.props.onReset==null||(c=i.props).onReset.apply(c,u),i.reset()},i}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,Wx(e,n),o.getDerivedStateFromError=function(i){return{error:i}};var r=o.prototype;return r.reset=function(){this.setState(nA)},r.componentDidCatch=function(i,s){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,s)},r.componentDidUpdate=function(i,s){var a,l,c,d,u=this.state.error,p=this.props.resetKeys;u!==null&&s.error!==null&&((c=i.resetKeys)===void 0&&(c=[]),(d=p)===void 0&&(d=[]),c.length!==d.length||c.some((function(h,g){return!Object.is(h,d[g])})))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,p),this.reset())},r.render=function(){var i=this.state.error,s=this.props,a=s.fallbackRender,l=s.FallbackComponent,c=s.fallback;if(i!==null){var d={error:i,resetErrorBoundary:this.resetErrorBoundary};if(EC(c))return c;if(typeof a=="function")return a(d);if(l)return Ji(l,d);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},o})(_C);function OV({children:t,onError:e}){return f(DV,{fallback:f("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var IV=Gx,oA=IV.LexicalErrorBoundary;var Jx={};$e(Jx,{createEmptyHistoryState:()=>BV,registerHistory:()=>FV});var Hf=0,Yx=1,qx=2,Uo=0,AV=1,rA=2,MV=3,LV=4;function RV(t,e,n,o,r){if(t===null||n.size===0&&o.size===0&&!r)return Uo;let i=e._selection,s=t._selection;if(r)return AV;if(!(B(i)&&B(s)&&s.isCollapsed()&&i.isCollapsed()))return Uo;let a=(function(b,y,v){let x=b._nodeMap,C=[];for(let E of y){let k=x.get(E);k!==void 0&&C.push(k)}for(let[E,k]of v){if(!k)continue;let T=x.get(E);T===void 0||ar(T)||C.push(T)}return C})(e,n,o);if(a.length===0)return Uo;if(a.length>1){let b=e._nodeMap,y=b.get(i.anchor.key),v=b.get(s.anchor.key);return y&&v&&!t._nodeMap.has(y.__key)&&te(y)&&y.__text.length===1&&i.anchor.offset===1?rA:Uo}let l=a[0],c=t._nodeMap.get(l.__key);if(!te(c)||!te(l)||c.__mode!==l.__mode)return Uo;let d=c.__text,u=l.__text;if(d===u)return Uo;let p=i.anchor,h=s.anchor;if(p.key!==h.key||p.type!=="text")return Uo;let g=p.offset,m=h.offset,_=u.length-d.length;return _===1&&m===g-1?rA:_===-1&&m===g+1?MV:_===-1&&m===g?LV:Uo}function PV(t,e){let n=Date.now(),o=Uo;return(r,i,s,a,l,c)=>{let d=Date.now();if(c.has(nl))return o=Uo,n=d,qx;let u=RV(r,i,a,l,t.isComposing()),p=(()=>{let h=s===null||s.editor===t,g=c.has(gO);if(!g&&h&&c.has(ol))return Hf;if(r===null)return Yx;let m=i._selection;return a.size>0||l.size>0?g===!1&&u!==Uo&&u===o&&d<n+e&&h||a.size===1&&(function(_,b,y){let v=b._nodeMap.get(_),x=y._nodeMap.get(_),C=b._selection,E=y._selection;return!(B(C)&&B(E)&&C.anchor.type==="element"&&C.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!te(v)||!te(x)||v.__parent!==x.__parent)&&JSON.stringify(b.read((()=>v.exportJSON())))===JSON.stringify(y.read((()=>x.exportJSON())))})(Array.from(a)[0],r,i)?Hf:Yx:m!==null?Hf:qx})();return n=d,o=u,p}}function iA(t){t.undoStack=[],t.redoStack=[],t.current=null}function FV(t,e,n){let o=PV(t,n);return He(t.registerCommand(wO,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(l.length!==0){let c=s.current,d=l.pop();c!==null&&(a.push(c),i.dispatchCommand(Is,!0)),l.length===0&&i.dispatchCommand(As,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:nl})}})(t,e),!0)),Te),t.registerCommand(yO,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(a.length!==0){let c=s.current;c!==null&&(l.push(c),i.dispatchCommand(As,!0));let d=a.pop();a.length===0&&i.dispatchCommand(Is,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:nl})}})(t,e),!0)),Te),t.registerCommand(lO,(()=>(iA(e),!1)),Te),t.registerCommand(cO,(()=>(iA(e),t.dispatchCommand(Is,!1),t.dispatchCommand(As,!1),!0)),Te),t.registerUpdateListener((({editorState:i,prevEditorState:s,dirtyLeaves:a,dirtyElements:l,tags:c})=>{let d=e.current,u=e.redoStack,p=e.undoStack,h=d===null?null:d.editorState;if(d!==null&&i===h)return;let g=o(s,i,d,a,l,c);if(g===Yx)u.length!==0&&(e.redoStack=[],t.dispatchCommand(Is,!1)),d!==null&&(p.push({...d}),t.dispatchCommand(As,!0));else if(g===qx)return;e.current={editor:t,editorState:i}})))}function BV(){return{current:null,redoStack:[],undoStack:[]}}var sA=Jx,Uf=sA.createEmptyHistoryState,aA=sA.registerHistory;var Xx={};$e(Xx,{HistoryPlugin:()=>$V,createEmptyHistoryState:()=>Uf});bt();function $V({delay:t,externalHistoryState:e}){let[n]=ve();return(function(o,r,i=1e3){let s=X((()=>r||Uf()),[r]);F((()=>aA(o,s,i)),[i,o,s])})(n,e,t),null}var lA=Xx,cA=lA.HistoryPlugin,dA=lA.createEmptyHistoryState;var Zx={};$e(Zx,{useLexicalNodeSelection:()=>zV});bt();function uA(t,e){return t.getEditorState().read((()=>{let n=Mt(e);return n!==null&&n.isSelected()}))}function zV(t){let[e]=ve(),[n,o]=L((()=>uA(e,t)));return F((()=>{let r=!0,i=e.registerUpdateListener((()=>{r&&o(uA(e,t))}));return()=>{r=!1,i()}}),[e,t]),[n,Ne((r=>{e.update((()=>{let i=z();gt(i)||(i=YD(),vt(i)),gt(i)&&(r?i.add(t):i.delete(t))}))}),[e,t]),Ne((()=>{e.update((()=>{let r=z();gt(r)&&r.clear()}))}),[e])]}var HV=Zx,Kf=HV.useLexicalNodeSelection;var ev={};$e(ev,{$createHorizontalRuleNode:()=>Qx,$isHorizontalRuleNode:()=>VV,HorizontalRuleNode:()=>dd,INSERT_HORIZONTAL_RULE_COMMAND:()=>UV});bt();var UV=jn("INSERT_HORIZONTAL_RULE_COMMAND");function KV({nodeKey:t}){let[e]=ve(),[n,o,r]=Kf(t);return F((()=>He(e.registerCommand(cr,(i=>{let s=e.getElementByKey(t);return i.target===s&&(i.shiftKey||r(),o(!n),!0)}),Re))),[r,e,n,t,o]),F((()=>{let i=e.getElementByKey(t),s=e._config.theme.hrSelected??"selected";i!==null&&(n?Ye(i,s):Wn(i,s))}),[e,n,t]),null}var dd=class t extends tl{static getType(){return"horizontalrule"}static clone(e){return new t(e.__key)}static importJSON(e){return Qx().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:jV,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){let n=document.createElement("hr");return Ye(n,e.theme.hr),n}getTextContent(){return`
116
+ `}isInline(){return!1}updateDOM(){return!1}decorate(){return f(KV,{nodeKey:this.__key})}};function jV(){return{node:Qx()}}function Qx(){return At(new dd)}function VV(t){return t instanceof dd}var jf=ev,dl=jf.$createHorizontalRuleNode,pA=jf.$isHorizontalRuleNode,Vf=jf.HorizontalRuleNode,Wf=jf.INSERT_HORIZONTAL_RULE_COMMAND;var tv={};$e(tv,{HorizontalRulePlugin:()=>WV});bt();function WV(){let[t]=ve();return F((()=>t.registerCommand(Wf,(e=>{let n=z();if(!B(n))return!1;if(n.focus.getNode()!==null){let o=dl();Lf(o)}return!0}),Te)),[t]),null}var GV=tv,fA=GV.HorizontalRulePlugin;var nv={};$e(nv,{LinkPlugin:()=>YV});bt();function YV({validateUrl:t,attributes:e}){let[n]=ve();return F((()=>{if(!n.hasNodes([al]))throw new Error("LinkPlugin: LinkNode not registered on editor");return He(n.registerCommand(Gn,(o=>{if(o===null)return Pf(o),!0;if(typeof o=="string")return!(t!==void 0&&!t(o))&&(Pf(o,e),!0);{let{url:r,target:i,rel:s,title:a}=o;return Pf(r,{...e,rel:s,target:i,title:a}),!0}}),Re),t!==void 0?n.registerCommand(Pi,(o=>{let r=z();if(!B(r)||r.isCollapsed()||!ao(o,ClipboardEvent)||o.clipboardData===null)return!1;let i=o.clipboardData.getData("text");return!!t(i)&&!r.getNodes().some((s=>Y(s)))&&(n.dispatchCommand(Gn,{...e,url:i}),o.preventDefault(),!0)}),Re):()=>{})}),[n,t,e]),null}var qV=nv,hA=qV.LinkPlugin;var ov={};$e(ov,{ListPlugin:()=>JV});bt();function JV({hasStrictIndent:t=!1}){let[e]=ve();return F((()=>{if(!e.hasNodes([fr,zi]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")}),[e]),F((()=>{if(t)return UI(e)}),[e,t]),(function(n){F((()=>HI(n)),[n])})(e),null}var XV=ov,gA=XV.ListPlugin;var rv={};$e(rv,{useLexicalEditable:()=>e8});bt();var ZV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?_n:F;function QV(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function e8(){return(function(t){let[e]=ve(),n=X((()=>t(e)),[e,t]),[o,r]=L((()=>n.initialValueFn())),i=J(o);return ZV((()=>{let{initialValueFn:s,subscribe:a}=n,l=s();return i.current!==l&&(i.current=l,r(l)),a((c=>{i.current=c,r(c)}))}),[n,t]),o})(QV)}var t8=rv,mA=t8.useLexicalEditable;var iv={};$e(iv,{registerDragonSupport:()=>n8});function n8(t){let e=window.location.origin,n=o=>{if(o.origin!==e)return;let r=t.getRootElement();if(document.activeElement!==r)return;let i=o.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let a=s.payload;if(a&&a.functionId==="makeChanges"){let l=a.args;if(l){let[c,d,u,p,h,g]=l;t.update((()=>{let m=z();if(B(m)){let _=m.anchor,b=_.getNode(),y=0,v=0;if(te(b)&&c>=0&&d>=0&&(y=c,v=c+d,m.setTextNodeRange(b,y,b,v)),y===v&&u===""||(m.insertRawText(u),b=_.getNode()),te(b)){y=p,v=p+h;let x=b.getTextContentSize();y=y>x?x:y,v=v>x?x:v,m.setTextNodeRange(b,y,b,v)}o.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var o8=iv,_A=o8.registerDragonSupport;var sv={};$e(sv,{$generateHtmlFromNodes:()=>i8,$generateNodesFromDOM:()=>r8});function r8(t,e){let n=e.body?e.body.childNodes:[],o=[],r=[];for(let i=0;i<n.length;i++){let s=n[i];if(!yA.has(s.nodeName)){let a=xA(s,t,r,!1);a!==null&&(o=o.concat(a))}}return(function(i){for(let s of i)s.getNextSibling()instanceof ax&&s.insertAfter(Fo());for(let s of i){let a=s.getChildren();for(let l of a)s.insertBefore(l);s.remove()}})(r),o}function i8(t,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=tt().getChildren();for(let r=0;r<o.length;r++)bA(t,o[r],n,e);return n.innerHTML}function bA(t,e,n,o=null){let r=o===null||e.isSelected(o),i=Y(e)&&e.excludeFromCopy("html"),s=e;if(o!==null){let h=Di(e);h=te(h)&&o!==null?Of(o,h):h,s=h}let a=Y(s)?s.getChildren():[],l=NO(t,s.getType()),c;c=l&&l.exportDOM!==void 0?l.exportDOM(t,s):s.exportDOM(t);let{element:d,after:u}=c;if(!d)return!1;let p=document.createDocumentFragment();for(let h=0;h<a.length;h++){let g=a[h],m=bA(t,g,p,o);!r&&Y(e)&&m&&e.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!i){if((en(d)||ux(d))&&d.append(p),n.append(d),u){let h=u.call(s,d);h&&(ux(d)?d.replaceChildren(h):d.replaceWith(h))}}else n.append(p);return r}var yA=new Set(["STYLE","SCRIPT"]);function xA(t,e,n,o,r=new Map,i){let s=[];if(yA.has(t.nodeName))return s;let a=null,l=(function(g,m){let{nodeName:_}=g,b=m._htmlConversions.get(_.toLowerCase()),y=null;if(b!==void 0)for(let v of b){let x=v(g);x!==null&&(y===null||(y.priority||0)<=(x.priority||0))&&(y=x)}return y!==null?y.conversion:null})(t,e),c=l?l(t):null,d=null;if(c!==null){d=c.after;let g=c.node;if(a=Array.isArray(g)?g[g.length-1]:g,a!==null){for(let[,m]of r)if(a=m(a,i),!a)break;a&&s.push(...Array.isArray(g)?g:[a])}c.forChild!=null&&r.set(t.nodeName,c.forChild)}let u=t.childNodes,p=[],h=(a==null||!zt(a))&&(a!=null&&Qa(a)||o);for(let g=0;g<u.length;g++)p.push(...xA(u[g],e,n,h,new Map(r),a));return d!=null&&(p=d(p)),Dx(t)&&(p=s8(t,p,h?()=>{let g=new ax;return n.push(g),g}:ge)),a==null?p.length>0?s=s.concat(p):Dx(t)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:nd(g.nextSibling)&&nd(g.previousSibling)})(t)&&(s=s.concat(Fo())):Y(a)&&a.append(...p),s}function s8(t,e,n){let o=t.style.textAlign,r=[],i=[];for(let s=0;s<e.length;s++){let a=e[s];if(Qa(a))o&&!a.getFormat()&&a.setFormat(o),r.push(a);else if(i.push(a),s===e.length-1||s<e.length-1&&Qa(e[s+1])){let l=n();l.setFormat(o),l.append(...i),r.push(l),i=[]}}return r}var vA=sv,CA=vA.$generateHtmlFromNodes,Gf=vA.$generateNodesFromDOM;var lv={};$e(lv,{$generateJSONFromSelectedNodes:()=>kA,$generateNodesFromSerializedNodes:()=>NA,$getClipboardDataFromSelection:()=>DA,$getHtmlContent:()=>wA,$getLexicalContent:()=>TA,$insertDataTransferForPlainText:()=>a8,$insertDataTransferForRichText:()=>l8,$insertGeneratedNodes:()=>av,copyToClipboard:()=>c8,setLexicalClipboardDataTransfer:()=>OA});function Yf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function wA(t,e=z()){return e==null&&Yf(166),B(e)&&e.isCollapsed()||e.getNodes().length===0?"":CA(t,e)}function TA(t,e=z()){return e==null&&Yf(166),B(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(kA(t,e))}function a8(t,e){let n=t.getData("text/plain")||t.getData("text/uri-list");n!=null&&e.insertRawText(n)}function l8(t,e,n){let o=t.getData("application/x-lexical-editor");if(o)try{let a=JSON.parse(o);if(a.namespace===n._config.namespace&&Array.isArray(a.nodes))return av(n,NA(a.nodes),e)}catch{}let r=t.getData("text/html"),i=t.getData("text/plain");if(r&&i!==r)try{let a=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(l):l})(r),"text/html");return av(n,Gf(n,a),e)}catch{}let s=i||t.getData("text/uri-list");if(s!=null)if(B(e)){let a=s.split(/(\r?\n|\t)/);a[a.length-1]===""&&a.pop();for(let l=0;l<a.length;l++){let c=z();if(B(c)){let d=a[l];d===`
117
+ `||d===`\r
118
+ `?c.insertParagraph():d===" "?c.insertNodes([Bo()]):c.insertText(d)}}}else e.insertRawText(s)}function av(t,e,n){t.dispatchCommand(td,{nodes:e,selection:n})||(n.insertNodes(e),(function(o){if(B(o)&&o.isCollapsed()){let r=o.anchor,i=null,s=Ni(r,"previous");if(s)if(ff(s))i=s.origin;else{let a=df(s,io(tt(),"next").getFlipped());for(let l of a){if(te(l.origin)){i=l.origin;break}if(Y(l.origin)&&!l.origin.isInline())break}}if(i&&te(i)){let a=i.getFormat(),l=i.getStyle();o.format===a&&o.style===l||(o.format=a,o.style=l,o.dirty=!0)}}})(n))}function SA(t,e,n,o=[]){let r=e===null||n.isSelected(e),i=Y(n)&&n.excludeFromCopy("html"),s=n;if(e!==null){let c=Di(n);c=te(c)&&e!==null?Of(e,c):c,s=c}let a=Y(s)?s.getChildren():[],l=(function(c){let d=c.exportJSON(),u=c.constructor;if(d.type!==u.getType()&&Yf(58,u.name),Y(c)){let p=d.children;Array.isArray(p)||Yf(59,u.name)}return d})(s);if(te(s)){let c=s.__text;c.length>0?l.text=c:r=!1}for(let c=0;c<a.length;c++){let d=a[c],u=SA(t,e,d,l.children);!r&&Y(n)&&u&&n.extractWithChild(d,e,"clone")&&(r=!0)}if(r&&!i)o.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){let d=l.children[c];o.push(d)}return r}function kA(t,e){let n=[],o=tt().getChildren();for(let r=0;r<o.length;r++)SA(t,e,o[r],n);return{namespace:t._config.namespace,nodes:n}}function NA(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=oO(o);te(r)&&GO(r),e.push(r)}return e}var ul=null;async function c8(t,e,n){if(ul!==null)return!1;if(e!==null)return new Promise(((c,d)=>{t.update((()=>{c(EA(t,e,n))}))}));let o=t.getRootElement(),r=t._window||window,i=window.document,s=so(r);if(o===null||s===null)return!1;let a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),o.append(a);let l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise(((c,d)=>{let u=t.registerCommand(bf,(p=>(ao(p,ClipboardEvent)&&(u(),ul!==null&&(window.clearTimeout(ul),ul=null),c(EA(t,p,n))),!0)),Nt);ul=window.setTimeout((()=>{u(),ul=null,c(!1)}),50),i.execCommand("copy"),a.remove()}))}function EA(t,e,n){if(n===void 0){let r=so(t._window);if(!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!MO(t,i,s))return!1;let a=z();if(a===null)return!1;n=DA(a)}e.preventDefault();let o=e.clipboardData;return o!==null&&(OA(o,n),!0)}var d8=[["text/html",wA],["application/x-lexical-editor",TA]];function DA(t=z()){let e={"text/plain":t?t.getTextContent():""};if(t){let n=Os();for(let[o,r]of d8){let i=r(n,t);i!==null&&(e[o]=i)}}return e}function OA(t,e){for(let n in e){let o=e[n];o!==void 0&&t.setData(n,o)}}var hr=lv,$ie=hr.$generateJSONFromSelectedNodes,zie=hr.$generateNodesFromSerializedNodes,IA=hr.$getClipboardDataFromSelection,Hie=hr.$getHtmlContent,Uie=hr.$getLexicalContent,Kie=hr.$insertDataTransferForPlainText,cv=hr.$insertDataTransferForRichText,jie=hr.$insertGeneratedNodes,ud=hr.copyToClipboard,Vie=hr.setLexicalClipboardDataTransfer;var fv={};$e(fv,{$createHeadingNode:()=>fl,$createQuoteNode:()=>pv,$isHeadingNode:()=>b8,$isQuoteNode:()=>m8,DRAG_DROP_PASTE:()=>uv,HeadingNode:()=>hd,QuoteNode:()=>fd,eventFiles:()=>pd,registerRichText:()=>y8});function AA(t,e){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(t,e);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){let n=document.caretPositionFromPoint(t,e);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}var hl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,u8=hl&&"documentMode"in document?document.documentMode:null,p8=!(!hl||!("InputEvent"in window)||u8)&&"getTargetRanges"in new window.InputEvent("input"),f8=hl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),MA=hl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,h8=hl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),g8=hl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!h8,uv=jn("DRAG_DROP_PASTE_FILE"),fd=class t extends Ht{static getType(){return"quote"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("blockquote");return Ye(n,e.theme.quote),n}updateDOM(e,n){return!1}static importDOM(){return{blockquote:e=>({conversion:_8,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(en(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return pv().updateFromJSON(e)}insertNewAfter(e,n){let o=ge(),r=this.getDirection();return o.setDirection(r),this.insertAfter(o,n),o}collapseAtStart(){let e=ge();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function pv(){return At(new fd)}function m8(t){return t instanceof fd}var hd=class t extends Ht{static getType(){return"heading"}static clone(e){return new t(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}setTag(e){let n=this.getWritable();return this.__tag=e,n}createDOM(e){let n=this.__tag,o=document.createElement(n),r=e.theme.heading;if(r!==void 0){let i=r[n];Ye(o,i)}return o}updateDOM(e,n,o){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:pl,priority:0}),h2:e=>({conversion:pl,priority:0}),h3:e=>({conversion:pl,priority:0}),h4:e=>({conversion:pl,priority:0}),h5:e=>({conversion:pl,priority:0}),h6:e=>({conversion:pl,priority:0}),p:e=>{let n=e.firstChild;return n!==null&&LA(n)?{conversion:()=>({node:null}),priority:3}:null},span:e=>LA(e)?{conversion:n=>({node:fl("h1")}),priority:3}:null}}exportDOM(e){let{element:n}=super.exportDOM(e);if(en(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return fl(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,n=!0){let o=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&o===r.getTextContentSize()||!e?ge():fl(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,n),o===0&&!this.isEmpty()&&e){let a=ge();a.select(),this.replace(a,!0)}return i}collapseAtStart(){let e=this.isEmpty()?ge():fl(this.getTag());return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}extractWithChild(){return!0}};function LA(t){return t.nodeName.toLowerCase()==="span"&&t.style.fontSize==="26pt"}function pl(t){let e=t.nodeName.toLowerCase(),n=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(n=fl(e),t.style!==null&&(fx(t,n),n.setFormat(t.style.textAlign))),{node:n}}function _8(t){let e=pv();return t.style!==null&&(e.setFormat(t.style.textAlign),fx(t,e)),{node:e}}function fl(t="h1"){return At(new hd(t))}function b8(t){return t instanceof hd}function pd(t){let e=null;if(ao(t,DragEvent)?e=t.dataTransfer:ao(t,ClipboardEvent)&&(e=t.clipboardData),e===null)return[!1,[],!1];let n=e.types,o=n.includes("Files"),r=n.includes("text/html")||n.includes("text/plain");return[o,Array.from(e.files),r]}function RA(t){let e=z();if(!B(e))return!1;let n=new Set,o=e.getNodes();for(let r=0;r<o.length;r++){let i=o[r],s=i.getKey();if(n.has(s))continue;let a=ue(i,(c=>Y(c)&&!c.isInline()));if(a===null)continue;let l=a.getKey();a.canIndent()&&!n.has(l)&&(n.add(l),t(a))}return n.size>0}function PA(t){let e=ln(t);return Hn(e)}function dv(t){for(let e of["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e)}function y8(t){return He(t.registerCommand(cr,(e=>{let n=z();return!!gt(n)&&(n.clear(),!0)}),Te),t.registerCommand(el,(e=>{let n=z();return B(n)?(n.deleteCharacter(e),!0):!!gt(n)&&(n.deleteNodes(),!0)}),Te),t.registerCommand(xf,(e=>{let n=z();return!!B(n)&&(n.deleteWord(e),!0)}),Te),t.registerCommand(Qc,(e=>{let n=z();return!!B(n)&&(n.deleteLine(e),!0)}),Te),t.registerCommand(_f,(e=>{let n=z();if(typeof e=="string")n!==null&&n.insertText(e);else{if(n===null)return!1;let o=e.dataTransfer;if(o!=null)cv(o,n,t);else if(B(n)){let r=e.data;return r&&n.insertText(r),!0}}return!0}),Te),t.registerCommand(xO,(()=>{let e=z();return!!B(e)&&(e.removeText(),!0)}),Te),t.registerCommand(at,(e=>{let n=z();return!!B(n)&&(n.formatText(e),!0)}),Te),t.registerCommand(vf,(e=>{let n=z();if(!B(n)&&!gt(n))return!1;let o=n.getNodes();for(let r of o){let i=ue(r,(s=>Y(s)&&!s.isInline()));i!==null&&i.setFormat(e)}return!0}),Te),t.registerCommand(lx,(e=>{let n=z();return!!B(n)&&(n.insertLineBreak(e),!0)}),Te),t.registerCommand(Mi,(()=>{let e=z();return!!B(e)&&(e.insertParagraph(),!0)}),Te),t.registerCommand(Ms,(()=>($o([Bo()]),!0)),Te),t.registerCommand(Kn,(()=>RA((e=>{let n=e.getIndent();e.setIndent(n+1)}))),Te),t.registerCommand(Eo,(()=>RA((e=>{let n=e.getIndent();n>0&&e.setIndent(Math.max(0,n-1))}))),Te),t.registerCommand(zo,(e=>{let n=z();if(gt(n)){let o=n.getNodes();if(o.length>0)return o[0].selectPrevious(),!0}else if(B(n)){let o=ox(n.focus,!0);if(!e.shiftKey&&Hn(o)&&!o.isIsolated()&&!o.isInline())return o.selectPrevious(),e.preventDefault(),!0}return!1}),Te),t.registerCommand(Vr,(e=>{let n=z();if(gt(n)){let o=n.getNodes();if(o.length>0)return o[0].selectNext(0,0),!0}else if(B(n)){if((function(r){let i=r.focus;return i.key==="root"&&i.offset===tt().getChildrenSize()})(n))return e.preventDefault(),!0;let o=ox(n.focus,!1);if(!e.shiftKey&&Hn(o)&&!o.isIsolated()&&!o.isInline())return o.selectNext(),e.preventDefault(),!0}return!1}),Te),t.registerCommand(rl,(e=>{let n=z();if(gt(n)){let o=n.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectPrevious(),!0}if(!B(n))return!1;if(vx(n,!0)){let o=e.shiftKey;return e.preventDefault(),xx(n,o,!0),!0}return!1}),Te),t.registerCommand(Cf,(e=>{let n=z();if(gt(n)){let r=n.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}if(!B(n))return!1;let o=e.shiftKey;return!!vx(n,!1)&&(e.preventDefault(),xx(n,o,!1),!0)}),Te),t.registerCommand(Ef,(e=>{if(PA(e.target))return!1;let n=z();if(B(n)){if((function(o){if(!o.isCollapsed())return!1;let{anchor:r}=o;if(r.offset!==0)return!1;let i=r.getNode();if(ar(i))return!1;let s=Rs(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))})(n))return e.preventDefault(),t.dispatchCommand(Eo,void 0);if(MA&&navigator.language==="ko-KR")return!1}else if(!gt(n))return!1;return e.preventDefault(),t.dispatchCommand(el,!0)}),Te),t.registerCommand(wf,(e=>{if(PA(e.target))return!1;let n=z();return!(!B(n)&&!gt(n))&&(e.preventDefault(),t.dispatchCommand(el,!1))}),Te),t.registerCommand(_O,(e=>{let n=z();if(!B(n))return!1;if(dv(n),e!==null){if((MA||f8||g8)&&p8)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(lx,!1)}return t.dispatchCommand(Mi,void 0)}),Te),t.registerCommand(Li,(()=>{let e=z();return!!B(e)&&(t.blur(),!0)}),Te),t.registerCommand(fO,(e=>{let[,n]=pd(e);if(n.length>0){let r=AA(e.clientX,e.clientY);if(r!==null){let{offset:i,node:s}=r,a=ln(s);if(a!==null){let l=sr();if(te(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{let d=a.getParentOrThrow().getKey(),u=a.getIndexWithinParent()+1;l.anchor.set(d,u,"element"),l.focus.set(d,u,"element")}let c=jr(l);vt(c)}t.dispatchCommand(uv,n)}return e.preventDefault(),!0}let o=z();return!!B(o)}),Te),t.registerCommand(pO,(e=>{let[n]=pd(e),o=z();return!(n&&!B(o))}),Te),t.registerCommand(uO,(e=>{let[n]=pd(e),o=z();if(n&&!B(o))return!1;let r=AA(e.clientX,e.clientY);if(r!==null){let i=ln(r.node);Hn(i)&&e.preventDefault()}return!0}),Te),t.registerCommand(CO,(()=>(hf(),!0)),Te),t.registerCommand(bf,(e=>(ud(t,ao(e,ClipboardEvent)?e:null),!0)),Te),t.registerCommand(yf,(e=>((async function(n,o){await ud(o,ao(n,ClipboardEvent)?n:null),o.update((()=>{let r=z();B(r)?r.removeText():gt(r)&&r.getNodes().forEach((i=>i.remove()))}))})(e,t),!0)),Te),t.registerCommand(Pi,(e=>{let[,n,o]=pd(e);return n.length>0&&!o?(t.dispatchCommand(uv,n),!0):Fi(e.target)&&AO(e.target)?!1:z()!==null&&((function(r,i){r.preventDefault(),i.update((()=>{let s=z(),a=ao(r,InputEvent)||ao(r,KeyboardEvent)?null:r.clipboardData;a!=null&&s!==null&&cv(a,s,i)}),{tag:bO})})(e,t),!0)}),Te),t.registerCommand(Tf,(e=>{let n=z();return B(n)&&dv(n),!1}),Te),t.registerCommand(Ri,(e=>{let n=z();return B(n)&&dv(n),!1}),Te))}var Wr=fv,$s=Wr.$createHeadingNode,zs=Wr.$createQuoteNode,Gr=Wr.$isHeadingNode,Yr=Wr.$isQuoteNode,Xie=Wr.DRAG_DROP_PASTE,qf=Wr.HeadingNode,Jf=Wr.QuoteNode,Zie=Wr.eventFiles,FA=Wr.registerRichText;var gv={};$e(gv,{RichTextPlugin:()=>x8});bt();bt();var hv=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?_n:F;function BA(t){return t.getEditorState().read(zf(t.isComposing()))}function x8({contentEditable:t,placeholder:e=null,ErrorBoundary:n}){let[o]=ve(),r=(function(i,s){let[a,l]=L((()=>i.getDecorators()));return hv((()=>i.registerDecoratorListener((c=>{Dl((()=>{l(c)}))}))),[i]),F((()=>{l(i.getDecorators())}),[i]),X((()=>{let c=[],d=Object.keys(a);for(let u=0;u<d.length;u++){let p=d[u],h=f(s,{onError:m=>i._onError(m),children:f(wd,{fallback:null,children:a[p]})}),g=i.getElementByKey(p);g!==null&&c.push(ii(h,g,p))}return c}),[s,a,i])})(o,n);return(function(i){hv((()=>He(FA(i),_A(i))),[i])})(o),f(ke,{children:[t,f(v8,{content:e}),r]})}function v8({content:t}){let[e]=ve(),n=(function(r){let[i,s]=L((()=>BA(r)));return hv((()=>{function a(){let l=BA(r);s(l)}return a(),He(r.registerUpdateListener((()=>{a()})),r.registerEditableListener((()=>{a()})))}),[r]),i})(e),o=mA();return n?typeof t=="function"?t(o):t:null}var C8=gv,$A=C8.RichTextPlugin;var mv={};$e(mv,{TabIndentationPlugin:()=>E8,registerTabIndentation:()=>zA});bt();function zA(t,e){return He(t.registerCommand(Ri,(n=>{let o=z();if(!B(o))return!1;n.preventDefault();let r=(function(i){let s=i.getNodes();if(fI(s,(p=>Qa(p)&&p.canIndent()?p:null)).length>0)return!0;let a=i.anchor,l=i.focus,c=l.isBefore(a)?l:a,d=c.getNode(),u=Rs(d);if(u.canIndent()){let p=u.getKey(),h=sr();if(h.anchor.set(p,0,"element"),h.focus.set(p,0,"element"),h=jr(h),h.anchor.is(c))return!0}return!1})(o)?n.shiftKey?Eo:Kn:Ms;return t.dispatchCommand(r,void 0)}),Te),t.registerCommand(Kn,(()=>{if(e==null)return!1;let n=z();if(!B(n))return!1;let o=n.getNodes().map((r=>Rs(r).getIndent()));return Math.max(...o)+1>=e}),Nt))}function E8({maxIndent:t}){let[e]=ve();return F((()=>zA(e,t)),[e,t]),null}var HA=mv,UA=HA.TabIndentationPlugin,hse=HA.registerTabIndentation;var Rv={};$e(Rv,{$computeTableMap:()=>cn,$computeTableMapSkipCellCheck:()=>Jr,$createTableCellNode:()=>qn,$createTableNode:()=>ih,$createTableNodeWithDimensions:()=>ZA,$createTableRowNode:()=>Ks,$createTableSelection:()=>Iv,$createTableSelectionFrom:()=>sM,$deleteTableColumn:()=>L8,$deleteTableColumnAtSelection:()=>oM,$deleteTableColumn__EXPERIMENTAL:()=>P8,$deleteTableRowAtSelection:()=>nM,$deleteTableRow__EXPERIMENTAL:()=>R8,$findCellNode:()=>_l,$findTableNode:()=>Us,$getElementForTableNode:()=>uM,$getNodeTriplet:()=>Kt,$getTableAndElementByKey:()=>Av,$getTableCellNodeFromLexicalNode:()=>S8,$getTableCellNodeRect:()=>Cv,$getTableColumnIndexFromTableCellNode:()=>N8,$getTableNodeFromLexicalNodeOrThrow:()=>rh,$getTableRowIndexFromTableCellNode:()=>k8,$getTableRowNodeFromTableCellNodeOrThrow:()=>Dv,$insertTableColumn:()=>A8,$insertTableColumnAtSelection:()=>tM,$insertTableColumn__EXPERIMENTAL:()=>M8,$insertTableRow:()=>O8,$insertTableRowAtSelection:()=>eM,$insertTableRow__EXPERIMENTAL:()=>I8,$isScrollableTablesActive:()=>oh,$isTableCellNode:()=>pe,$isTableNode:()=>lt,$isTableRowNode:()=>qe,$isTableSelection:()=>Ke,$mergeCells:()=>rM,$removeTableRowAtIndex:()=>D8,$unmergeCell:()=>B8,INSERT_TABLE_COMMAND:()=>XA,TableCellHeaderStates:()=>Je,TableCellNode:()=>Hi,TableNode:()=>Ki,TableObserver:()=>nh,TableRowNode:()=>yl,applyTableHandlers:()=>aM,getDOMCellFromTarget:()=>_d,getTableElement:()=>Ui,getTableObserverFromTableElement:()=>wv,registerTableCellUnmergeTransform:()=>eW,registerTablePlugin:()=>nW,registerTableSelectionObserver:()=>tW,setScrollableTablesActive:()=>G8});var kv=/^(\d+(?:\.\d+)?)px$/,Je={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},Hi=class t extends Ht{static getType(){return"tablecell"}static clone(e){return new t(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:KA,priority:0}),th:e=>({conversion:KA,priority:0})}}static importJSON(e){return qn().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Je.NO_STATUS,n=1,o,r){super(r),this.__colSpan=n,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),bv(this.__verticalAlign)&&(n.style.verticalAlign=this.__verticalAlign),Ye(n,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),n}exportDOM(e){let n=super.exportDOM(e);if(Ls(n.element)){let o=n.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return n}exportJSON(){return{...super.exportJSON(),...bv(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let n=this.getWritable();return n.__colSpan=e,n}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let n=this.getWritable();return n.__rowSpan=e,n}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,n=Je.BOTH){let o=this.getWritable();return o.__headerState=e&n|o.__headerState&~n,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let n=this.getWritable();return n.__width=e,n}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let n=this.getWritable();return n.__backgroundColor=e,n}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let n=this.getWritable();return n.__verticalAlign=e||void 0,n}toggleHeaderStyle(e){let n=this.getWritable();return(n.__headerState&e)===e?n.__headerState-=e:n.__headerState+=e,n}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Je.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function bv(t){return t==="middle"||t==="bottom"}function KA(t){let e=t,n=t.nodeName.toLowerCase(),o;kv.test(e.style.width)&&(o=parseFloat(e.style.width));let r=qn(n==="th"?Je.ROW:Je.NO_STATUS,e.colSpan,o);r.__rowSpan=e.rowSpan;let i=e.style.backgroundColor;i!==""&&(r.__backgroundColor=i);let s=e.style.verticalAlign;bv(s)&&(r.__verticalAlign=s);let a=e.style,l=(a&&a.textDecoration||"").split(" "),c=a.fontWeight==="700"||a.fontWeight==="bold",d=l.includes("line-through"),u=a.fontStyle==="italic",p=l.includes("underline");return{after:h=>{let g=[],m=null,_=()=>{if(m){let b=m.getFirstChild();Ze(b)&&m.getChildrenSize()===1&&b.remove()}};for(let b of h)nO(b)||te(b)||Ze(b)?(te(b)&&(c&&b.toggleFormat("bold"),d&&b.toggleFormat("strikethrough"),u&&b.toggleFormat("italic"),p&&b.toggleFormat("underline")),m?m.append(b):(m=ge().append(b),g.push(m))):(g.push(b),_(),m=null);return _(),g.length===0&&g.push(ge()),g},node:r}}function qn(t=Je.NO_STATUS,e=1,n){return At(new Hi(t,e,n))}function pe(t){return t instanceof Hi}var XA=jn("INSERT_TABLE_COMMAND");function se(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var yl=class t extends Ht{static getType(){return"tablerow"}static clone(e){return new t(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:w8,priority:0})}}static importJSON(e){return Ks().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,n){super(n),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),Ye(n,e.theme.tableRow),n}extractWithChild(e,n,o){return o==="html"}isShadowRoot(){return!0}setHeight(e){let n=this.getWritable();return n.__height=e,n}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function w8(t){let e=t,n;return kv.test(e.style.height)&&(n=parseFloat(e.style.height)),{after:o=>kx(o,pe),node:Ks(n)}}function Ks(t){return At(new yl(t))}function qe(t){return t instanceof yl}var Nv=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,T8=Nv&&"documentMode"in document?document.documentMode:null,jA=Nv&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function ZA(t,e,n=!0){let o=ih();for(let r=0;r<t;r++){let i=Ks();for(let s=0;s<e;s++){let a=Je.NO_STATUS;typeof n=="object"?(r===0&&n.rows&&(a|=Je.ROW),s===0&&n.columns&&(a|=Je.COLUMN)):n&&(r===0&&(a|=Je.ROW),s===0&&(a|=Je.COLUMN));let l=qn(a),c=ge();c.append(kt()),l.append(c),i.append(l)}o.append(i)}return o}function S8(t){let e=ue(t,(n=>pe(n)));return pe(e)?e:null}function Dv(t){let e=ue(t,(n=>qe(n)));if(qe(e))return e;throw new Error("Expected table cell to be inside of table row.")}function rh(t){let e=ue(t,(n=>lt(n)));if(lt(e))return e;throw new Error("Expected table cell to be inside of table.")}function k8(t){let e=Dv(t);return rh(e).getChildren().findIndex((n=>n.is(e)))}function N8(t){return Dv(t).getChildren().findIndex((e=>e.is(t)))}function QA(t,e){let n=rh(t),{x:o,y:r}=n.getCordsFromCellNode(t,e);return{above:n.getCellNodeFromCords(o,r-1,e),below:n.getCellNodeFromCords(o,r+1,e),left:n.getCellNodeFromCords(o-1,r,e),right:n.getCellNodeFromCords(o+1,r,e)}}function D8(t,e){let n=t.getChildren();if(e>=n.length||e<0)throw new Error("Expected table cell to be inside of table row.");return n[e].remove(),t}function O8(t,e,n=!0,o,r){let i=t.getChildren();if(e>=i.length||e<0)throw new Error("Table row target index out of range");let s=i[e];if(!qe(s))throw new Error("Row before insertion index does not exist.");for(let a=0;a<o;a++){let l=s.getChildren(),c=l.length,d=Ks();for(let u=0;u<c;u++){let p=l[u];pe(p)||se(12);let{above:h,below:g}=QA(p,r),m=Je.NO_STATUS,_=h&&h.getWidth()||g&&g.getWidth()||void 0;(h&&h.hasHeaderState(Je.COLUMN)||g&&g.hasHeaderState(Je.COLUMN))&&(m|=Je.COLUMN);let b=qn(m,1,_);b.append(ge()),d.append(b)}n?s.insertAfter(d):s.insertBefore(d)}return t}Nv&&"InputEvent"in window&&!T8&&new window.InputEvent("input");var yv=(t,e)=>t===Je.BOTH||t===e?e:Je.NO_STATUS;function eM(t=!0){let e=z();B(e)||Ke(e)||se(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Kt(n),[i,,s]=Kt(o),[,a,l]=cn(s,i,r),{startRow:c}=l,{startRow:d}=a;return t?xv(c+r.__rowSpan>d+i.__rowSpan?r:i,!0):xv(d<c?i:r,!1)}var I8=eM;function xv(t,e=!0){let[,,n]=Kt(t),[o,r]=cn(n,t,t),i=o[0].length,{startRow:s}=r,a=null;if(e){let l=s+t.__rowSpan-1,c=o[l],d=Ks();for(let p=0;p<i;p++){let{cell:h,startRow:g}=c[p];if(g+h.__rowSpan-1<=l){let m=c[p].cell.__headerState,_=yv(m,Je.COLUMN);d.append(qn(_).append(ge()))}else h.setRowSpan(h.__rowSpan+1)}let u=n.getChildAtIndex(l);qe(u)||se(256),u.insertAfter(d),a=d}else{let l=s,c=o[l],d=Ks();for(let p=0;p<i;p++){let{cell:h,startRow:g}=c[p];if(g===l){let m=c[p].cell.__headerState,_=yv(m,Je.COLUMN);d.append(qn(_).append(ge()))}else h.setRowSpan(h.__rowSpan+1)}let u=n.getChildAtIndex(l);qe(u)||se(257),u.insertBefore(d),a=d}return a}function A8(t,e,n=!0,o,r){let i=t.getChildren(),s=[];for(let a=0;a<i.length;a++){let l=i[a];if(qe(l))for(let c=0;c<o;c++){let d=l.getChildren();if(e>=d.length||e<0)throw new Error("Table column target index out of range");let u=d[e];pe(u)||se(12);let{left:p,right:h}=QA(u,r),g=Je.NO_STATUS;(p&&p.hasHeaderState(Je.ROW)||h&&h.hasHeaderState(Je.ROW))&&(g|=Je.ROW);let m=qn(g);m.append(ge()),s.push({newTableCell:m,targetCell:u})}}return s.forEach((({newTableCell:a,targetCell:l})=>{n?l.insertAfter(a):l.insertBefore(a)})),t}function tM(t=!0){let e=z();B(e)||Ke(e)||se(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Kt(n),[i,,s]=Kt(o),[,a,l]=cn(s,i,r),{startColumn:c}=l,{startColumn:d}=a;return t?vv(c+r.__colSpan>d+i.__colSpan?r:i,!0):vv(d<c?i:r,!1)}var M8=tM;function vv(t,e=!0,n=!0){let[,,o]=Kt(t),[r,i]=cn(o,t,t),s=r.length,{startColumn:a}=i,l=e?a+t.__colSpan-1:a-1,c=o.getFirstChild();qe(c)||se(120);let d=null;function u(g=Je.NO_STATUS){let m=qn(g).append(ge());return d===null&&(d=m),m}let p=c;e:for(let g=0;g<s;g++){if(g!==0){let C=p.getNextSibling();qe(C)||se(121),p=C}let m=r[g],_=m[l<0?0:l].cell.__headerState,b=yv(_,Je.ROW);if(l<0){Ov(p,u(b));continue}let{cell:y,startColumn:v,startRow:x}=m[l];if(v+y.__colSpan-1<=l){let C=y,E=x,k=l;for(;E!==g&&C.__rowSpan>1;){if(k-=y.__colSpan,!(k>=0)){p.append(u(b));continue e}{let{cell:T,startRow:w}=m[k];C=T,E=w}}C.insertAfter(u(b))}else y.setColSpan(y.__colSpan+1)}d!==null&&n&&md(d);let h=o.getColWidths();if(h){let g=[...h],m=l<0?0:l,_=g[m];g.splice(m,0,_),o.setColWidths(g)}return d}function L8(t,e){let n=t.getChildren();for(let o=0;o<n.length;o++){let r=n[o];if(qe(r)){let i=r.getChildren();if(e>=i.length||e<0)throw new Error("Table column target index out of range");i[e].remove()}}return t}function nM(){let t=z();B(t)||Ke(t)||se(188);let[e,n]=t.isBackward()?[t.focus.getNode(),t.anchor.getNode()]:[t.anchor.getNode(),t.focus.getNode()],[o,,r]=Kt(e),[i]=Kt(n),[s,a,l]=cn(r,o,i),{startRow:c}=a,{startRow:d}=l,u=d+i.__rowSpan-1;if(s.length===u-c+1)return void r.remove();let p=s[0].length,h=s[u+1],g=r.getChildAtIndex(u+1);for(let m=u;m>=c;m--){for(let b=p-1;b>=0;b--){let{cell:y,startRow:v,startColumn:x}=s[m][b];if(x===b){if(v<c||v+y.__rowSpan-1>u){let C=Math.max(v,c),E=Math.min(y.__rowSpan+v-1,u),k=C<=E?E-C+1:0;y.setRowSpan(y.__rowSpan-k)}if(v>=c&&v+y.__rowSpan-1>u&&m===u){g===null&&se(122);let C=null;for(let E=0;E<b;E++){let k=h[E],T=k.cell;k.startRow===m+1&&(C=T),T.__colSpan>1&&(E+=T.__colSpan-1)}C===null?Ov(g,y):C.insertAfter(y)}}}let _=r.getChildAtIndex(m);qe(_)||se(206,String(m)),_.remove()}if(h!==void 0){let{cell:m}=h[0];md(m)}else{let m=s[c-1],{cell:_}=m[0];md(_)}}var R8=nM;function oM(){let t=z();B(t)||Ke(t)||se(188);let e=t.anchor.getNode(),n=t.focus.getNode(),[o,,r]=Kt(e),[i]=Kt(n),[s,a,l]=cn(r,o,i),{startColumn:c}=a,{startRow:d,startColumn:u}=l,p=Math.min(c,u),h=Math.max(c+o.__colSpan-1,u+i.__colSpan-1),g=h-p+1;if(s[0].length===h-p+1)return r.selectPrevious(),void r.remove();let m=s.length;for(let v=0;v<m;v++)for(let x=p;x<=h;x++){let{cell:C,startColumn:E}=s[v][x];if(E<p){if(x===p){let k=p-E;C.setColSpan(C.__colSpan-Math.min(g,C.__colSpan-k))}}else if(E+C.__colSpan-1>h){if(x===h){let k=h-E+1;C.setColSpan(C.__colSpan-k)}}else C.remove()}let _=s[d],b=c>u?_[c+o.__colSpan]:_[u+i.__colSpan];if(b!==void 0){let{cell:v}=b;md(v)}else{let v=u<c?_[u-1]:_[c-1],{cell:x}=v;md(x)}let y=r.getColWidths();if(y){let v=[...y];v.splice(p,g),r.setColWidths(v)}}var P8=oM;function md(t){let e=t.getFirstDescendant();e==null?t.selectStart():e.getParentOrThrow().selectStart()}function Ov(t,e){let n=t.getFirstChild();n!==null?n.insertBefore(e):t.append(e)}function rM(t){if(t.length===0)return null;let e=rh(t[0]),[n]=Jr(e,null,null),o=1/0,r=-1/0,i=1/0,s=-1/0,a=new Set;for(let h of n)for(let g of h){if(!g||!g.cell)continue;let m=g.cell.getKey();if(!a.has(m)&&t.some((_=>_.is(g.cell)))){a.add(m);let _=g.startRow,b=g.startColumn,y=g.cell.__rowSpan||1,v=g.cell.__colSpan||1;o=Math.min(o,_),r=Math.max(r,_+y-1),i=Math.min(i,b),s=Math.max(s,b+v-1)}}if(o===1/0||i===1/0)return null;let l=r-o+1,c=s-i+1,d=n[o][i];if(!d.cell)return null;let u=d.cell;u.setColSpan(c),u.setRowSpan(l);let p=new Set([u.getKey()]);for(let h=o;h<=r;h++)for(let g=i;g<=s;g++){let m=n[h][g];if(!m.cell)continue;let _=m.cell,b=_.getKey();p.has(b)||(p.add(b),F8(_)||u.append(..._.getChildren()),_.remove())}return u.getChildrenSize()===0&&u.append(ge()),u}function F8(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Qt(e)||!e.isEmpty())}function B8(){let t=z();B(t)||Ke(t)||se(188);let e=t.anchor.getNode(),n=ue(e,pe);return pe(n)||se(148),iM(n)}function iM(t){let[e,n,o]=Kt(t),r=e.__colSpan,i=e.__rowSpan;if(r===1&&i===1)return;let[s,a]=cn(o,e,e),{startColumn:l,startRow:c}=a,d=e.__headerState&Je.COLUMN,u=Array.from({length:r},((g,m)=>{let _=d;for(let b=0;_!==0&&b<s.length;b++)_&=s[b][m+l].cell.__headerState;return _})),p=e.__headerState&Je.ROW,h=Array.from({length:i},((g,m)=>{let _=p;for(let b=0;_!==0&&b<s[0].length;b++)_&=s[m+c][b].cell.__headerState;return _}));if(r>1){for(let g=1;g<r;g++)e.insertAfter(qn(u[g]|h[0]).append(ge()));e.setColSpan(1)}if(i>1){let g;for(let m=1;m<i;m++){let _=c+m,b=s[_];g=(g||n).getNextSibling(),qe(g)||se(125);let y=null;for(let v=0;v<l;v++){let x=b[v],C=x.cell;x.startRow===_&&(y=C),C.__colSpan>1&&(v+=C.__colSpan-1)}if(y===null)for(let v=r-1;v>=0;v--)Ov(g,qn(u[v]|h[m]).append(ge()));else for(let v=r-1;v>=0;v--)y.insertAfter(qn(u[v]|h[m]).append(ge()))}e.setRowSpan(1)}}function cn(t,e,n){let[o,r,i]=Jr(t,e,n);return r===null&&se(207),i===null&&se(208),[o,r,i]}function Jr(t,e,n){let o=[],r=null,i=null;function s(l){let c=o[l];return c===void 0&&(o[l]=c=[]),c}let a=t.getChildren();for(let l=0;l<a.length;l++){let c=a[l];qe(c)||se(209);let d=s(l);for(let u=c.getFirstChild(),p=0;u!=null;u=u.getNextSibling()){for(pe(u)||se(147);d[p]!==void 0;)p++;let h={cell:u,startColumn:p,startRow:l},{__rowSpan:g,__colSpan:m}=u;for(let _=0;_<g&&!(l+_>=a.length);_++){let b=s(l+_);for(let y=0;y<m;y++)b[p+y]=h}e!==null&&r===null&&e.is(u)&&(r=h),n!==null&&i===null&&n.is(u)&&(i=h)}}return[o,r,i]}function Kt(t){let e;if(t instanceof Hi)e=t;else if("__type"in t){let r=ue(t,pe);pe(r)||se(148),e=r}else{let r=ue(t.getNode(),pe);pe(r)||se(148),e=r}let n=e.getParent();qe(n)||se(149);let o=n.getParent();return lt(o)||se(210),[e,n,o]}function eh(t,e,n){let o,r=Math.min(e.startColumn,n.startColumn),i=Math.min(e.startRow,n.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),a=Math.max(e.startRow+e.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{o=!1;for(let l=0;l<t.length;l++)for(let c=0;c<t[0].length;c++){let d=t[l][c];if(!d)continue;let u=d.startColumn+d.cell.__colSpan-1,p=d.startRow+d.cell.__rowSpan-1,h=d.startColumn<=s&&u>=r,g=d.startRow<=a&&p>=i;if(h&&g){let m=Math.min(r,d.startColumn),_=Math.max(s,u),b=Math.min(i,d.startRow),y=Math.max(a,p);m===r&&_===s&&b===i&&y===a||(r=m,s=_,i=b,a=y,o=!0)}}}while(o);return{maxColumn:s,maxRow:a,minColumn:r,minRow:i}}function Cv(t){let[e,,n]=Kt(t),o=n.getChildren(),r=o.length,i=o[0].getChildren().length,s=new Array(r);for(let a=0;a<r;a++)s[a]=new Array(i);for(let a=0;a<r;a++){let l=o[a].getChildren(),c=0;for(let d=0;d<l.length;d++){for(;s[a][c];)c++;let u=l[d],p=u.__rowSpan||1,h=u.__colSpan||1;for(let g=0;g<p;g++)for(let m=0;m<h;m++)s[a+g][c+m]=u;if(e===u)return{colSpan:h,columnIndex:c,rowIndex:a,rowSpan:p};c+=h}}return null}function VA(t){let[[e,n,o,r],[i,s,a,l]]=["anchor","focus"].map((c=>{let d=t[c].getNode(),u=ue(d,pe);pe(u)||se(238,c,d.getKey(),d.getType());let p=u.getParent();qe(p)||se(239,c);let h=p.getParent();return lt(h)||se(240,c),[d,u,p,h]}));return r.is(l)||se(241),{anchorCell:n,anchorNode:e,anchorRow:o,anchorTable:r,focusCell:s,focusNode:i,focusRow:a,focusTable:l}}var th=class t{constructor(e,n,o){this.anchor=n,this.focus=o,n._selection=this,o._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){return this.tableKey!=="root"&&this.anchor.key!=="root"&&this.anchor.type==="element"&&this.focus.key!=="root"&&this.focus.type==="element"}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Ke(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,n,o){this.dirty=this.dirty||e!==this.tableKey||n!==this.anchor.key||o!==this.focus.key,this.tableKey=e,this.anchor.key=n,this.focus.key=o,this._cachedNodes=null}clone(){return new t(this.tableKey,ir(this.anchor.key,this.anchor.offset,this.anchor.type),ir(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let n=0;this.getNodes().filter(pe).forEach((r=>{let i=r.getFirstChild();Qt(i)&&(n|=i.getTextFormat())}));let o=EO[e];return!!(n&o)}insertNodes(e){let n=this.focus.getNode();Y(n)||se(151),jr(n.select(0,n.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:n}=VA(this),o=Cv(e);o===null&&se(153);let r=Cv(n);r===null&&se(155);let i=Math.min(o.columnIndex,r.columnIndex),s=Math.max(o.columnIndex+o.colSpan-1,r.columnIndex+r.colSpan-1),a=Math.min(o.rowIndex,r.rowIndex),l=Math.max(o.rowIndex+o.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(a,l),toX:Math.max(i,s),toY:Math.max(a,l)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:n,anchorCell:o,focusCell:r}=VA(this),i=r.getParents()[1];if(i!==n){if(n.isParentOf(r)){let _=i.getParent();_==null&&se(159),this.set(this.tableKey,r.getKey(),_.getKey())}else{let _=n.getParent();_==null&&se(158),this.set(this.tableKey,_.getKey(),r.getKey())}return this.getNodes()}let[s,a,l]=cn(n,o,r),{minColumn:c,maxColumn:d,minRow:u,maxRow:p}=eh(s,a,l),h=new Map([[n.getKey(),n]]),g=null;for(let _=u;_<=p;_++)for(let b=c;b<=d;b++){let{cell:y}=s[_][b],v=y.getParent();qe(v)||se(160),v!==g&&(h.set(v.getKey(),v),g=v),h.has(y.getKey())||$8(y,(x=>{h.set(x.getKey(),x)}))}let m=Array.from(h.values());return OO()||(this._cachedNodes=m),m}getTextContent(){let e=this.getNodes().filter((o=>pe(o))),n="";for(let o=0;o<e.length;o++){let r=e[o],i=r.__parent,s=(e[o+1]||{}).__parent;n+=r.getTextContent()+(s!==i?`
119
+ `:" ")}return n}};function Ke(t){return t instanceof th}function Iv(){let t=ir("root",0,"element"),e=ir("root",0,"element");return new th("root",t,e)}function sM(t,e,n){t.getKey(),e.getKey(),n.getKey();let o=z(),r=Ke(o)?o.clone():Iv();return r.set(t.getKey(),e.getKey(),n.getKey()),r}function $8(t,e){let n=[[t]];for(let o=n.at(-1);o!==void 0&&n.length>0;o=n.at(-1)){let r=o.pop();r===void 0?n.pop():e(r)!==!1&&Y(r)&&n.push(r.getChildren())}}function Av(t,e=Os()){let n=Mt(t);lt(n)||se(231,t);let o=Ui(n,e.getElementByKey(t));return o===null&&se(232,t),{tableElement:o,tableNode:n}}var nh=class{constructor(e,n){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=n,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Av(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver((n=>{this.editor.getEditorState().read((()=>{let o=!1;for(let s=0;s<n.length;s++){let a=n[s].target.nodeName;if(a==="TABLE"||a==="TBODY"||a==="THEAD"||a==="TR"){o=!0;break}}if(!o)return;let{tableNode:r,tableElement:i}=this.$lookup();this.table=bl(r,i)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{let{tableNode:n,tableElement:o}=this.$lookup();this.table=bl(n,o),e.observe(o,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:n,tableElement:o}=this.$lookup();Xf(e,bl(n,o),null),z()!==null&&(vt(null),e.dispatchCommand(gn,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:n}=this.$lookup();Wn(n,e._config.theme.tableSelection),n.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();Ye(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&se(233,e.tableKey,this.tableNodeKey);let n=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Xf(n,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=so(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,n=!1){let o=this.editor,{tableNode:r}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,this.isHighlightingCells||this.anchorX===i&&this.anchorY===s&&!n){if(i===this.focusX&&s===this.focusY)return!1}else this.isHighlightingCells=!0,this.$disableHighlightStyle();if(this.focusX=i,this.focusY=s,this.isHighlightingCells){let a=Tv(r,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&a!==null)return this.focusCellNodeKey=a.getKey(),this.tableSelection=sM(r,this.$getAnchorTableCellOrThrow(),a),vt(this.tableSelection),o.dispatchCommand(gn,void 0),Xf(o,this.table,this.tableSelection),!0}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?Mt(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&se(234),e}$getFocusTableCell(){return this.focusCellNodeKey?Mt(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&se(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y;let{tableNode:n}=this.$lookup(),o=Tv(n,e.elem);if(o!==null){let r=o.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():Iv(),this.anchorCellNodeKey=r}}$formatCells(e){let n=z();Ke(n)||se(236);let o=sr(),r=o.anchor,i=o.focus,s=n.getNodes().filter(pe);s.length>0||se(237);let a=s[0].getFirstChild(),l=Qt(a)?a.getFormatFlags(e,null):null;s.forEach((c=>{r.set(c.getKey(),0,"element"),i.set(c.getKey(),c.getChildrenSize(),"element"),o.formatText(e,l)})),vt(n),this.editor.dispatchCommand(gn,void 0)}$clearText(){let{editor:e}=this,n=Mt(this.tableNodeKey);if(!lt(n))throw new Error("Expected TableNode.");let o=z();Ke(o)||se(253);let r=o.getNodes().filter(pe),i=n.getFirstChild(),s=n.getLastChild();if(r.length>0&&i!==null&&s!==null&&qe(i)&&qe(s)&&r[0]===i.getFirstChild()&&r[r.length-1]===s.getLastChild()){n.selectPrevious();let a=n.getParent();return n.remove(),void(ar(a)&&a.isEmpty()&&e.dispatchCommand(Mi,void 0))}r.forEach((a=>{if(Y(a)){let l=ge(),c=kt();l.append(c),a.append(l),a.getChildren().forEach((d=>{d!==l&&d.remove()}))}})),Xf(e,this.table,null),vt(null),e.dispatchCommand(gn,void 0)}},Ev="__lexicalTableSelection",z8=t=>!(1&~t.buttons);function ml(t){return Ls(t)&&t.nodeName==="TABLE"}function Ui(t,e){if(!e)return e;let n=ml(e)?e:t.getDOMSlot(e).element;return n.nodeName!=="TABLE"&&se(245,e.nodeName),n}function Mv(t){return t._window}function gd(t,e){for(let n=e,o=null;n!==null;n=n.getParent()){if(t.is(n))return o;pe(n)&&(o=n)}return null}var H8=[[Vr,"down"],[zo,"up"],[rl,"backward"],[Cf,"forward"]],U8=[xf,Qc,el],K8=[Ef,wf];function aM(t,e,n,o){let r=n.getRootElement(),i=Mv(n);r!==null&&i!==null||se(246);let s=new nh(n,t.getKey()),a=Ui(t,e);(function(h,g){wv(h)!==null&&se(205),h[Ev]=g})(a,s),s.listenersToRemove.add((()=>(function(h,g){wv(h)===g&&delete h[Ev]})(a,s)));let l=h=>{if(s.pointerType=h.pointerType,h.button!==0||!Fi(h.target)||!i)return;let g=_d(h.target);g!==null&&n.update((()=>{let m=Kr();if(jA&&h.shiftKey&&gr(m,t)&&(B(m)||Ke(m))){let _=m.anchor.getNode(),b=gd(t,m.anchor.getNode());b?(s.$setAnchorCellForSelection(Hs(s,b)),s.$setFocusCellForSelection(g),qr(h)):(t.isBefore(_)?t.selectStart():t.selectEnd()).anchor.set(m.anchor.key,m.anchor.offset,m.anchor.type)}else h.pointerType!=="touch"&&s.$setAnchorCellForSelection(g)})),(()=>{if(s.isSelecting)return;let m=()=>{s.isSelecting=!1,i.removeEventListener("pointerup",m),i.removeEventListener("pointermove",_)},_=b=>{if(!z8(b)&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("pointerup",m),void i.removeEventListener("pointermove",_);if(!Fi(b.target))return;let y=null,v=!(jA||a.contains(b.target));if(v)y=WA(a,b.target);else for(let x of document.elementsFromPoint(b.clientX,b.clientY))if(y=WA(a,x),y)break;!y||s.focusCell!==null&&y.elem===s.focusCell.elem||(s.setNextFocus({focusCell:y,override:v}),n.dispatchCommand(gn,void 0))};s.isSelecting=!0,i.addEventListener("pointerup",m,s.listenerOptions),i.addEventListener("pointermove",_,s.listenerOptions)})()};a.addEventListener("pointerdown",l,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("pointerdown",l)}));let c=h=>{h.detail>=3&&Fi(h.target)&&_d(h.target)!==null&&h.preventDefault()};a.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));let d=h=>{let g=h.target;h.button===0&&Fi(g)&&n.update((()=>{let m=z();Ke(m)&&m.tableKey===s.tableNodeKey&&r.contains(g)&&s.$clearHighlight()}))};i.addEventListener("pointerdown",d,s.listenerOptions),s.listenersToRemove.add((()=>{i.removeEventListener("pointerdown",d)}));for(let[h,g]of H8)s.listenersToRemove.add(n.registerCommand(h,(m=>dM(n,m,g,t,s)),Ai));s.listenersToRemove.add(n.registerCommand(Li,(h=>{let g=z();if(Ke(g)){let m=gd(t,g.focus.getNode());if(m!==null)return qr(h),m.selectEnd(),!0}return!1}),Ai));let u=h=>()=>{let g=z();if(!gr(g,t))return!1;if(Ke(g))return s.$clearText(),!0;if(B(g)){if(!pe(gd(t,g.anchor.getNode())))return!1;let m=g.anchor.getNode(),_=g.focus.getNode(),b=t.isParentOf(m),y=t.isParentOf(_);if(b&&!y||y&&!b)return s.$clearText(),!0;let v=ue(g.anchor.getNode(),(C=>Y(C))),x=v&&ue(v,(C=>Y(C)&&pe(C.getParent())));if(!Y(x)||!Y(v))return!1;if(h===Qc&&x.getPreviousSibling()===null)return!0}return!1};for(let h of U8)s.listenersToRemove.add(n.registerCommand(h,u(h),Nt));let p=h=>{let g=z();if(!Ke(g)&&!B(g))return!1;let m=t.isParentOf(g.anchor.getNode());if(m!==t.isParentOf(g.focus.getNode())){let _=m?"anchor":"focus",b=m?"focus":"anchor",{key:y,offset:v,type:x}=g[b];return t[g[_].isBefore(g[b])?"selectPrevious":"selectNext"]()[b].set(y,v,x),!1}return!!gr(g,t)&&!!Ke(g)&&(h&&(h.preventDefault(),h.stopPropagation()),s.$clearText(),!0)};for(let h of K8)s.listenersToRemove.add(n.registerCommand(h,p,Nt));return s.listenersToRemove.add(n.registerCommand(yf,(h=>{let g=z();if(g){if(!Ke(g)&&!B(g))return!1;ud(n,ao(h,ClipboardEvent)?h:null,IA(g));let m=p(h);return B(g)?(g.removeText(),!0):m}return!1}),Nt)),s.listenersToRemove.add(n.registerCommand(at,(h=>{let g=z();if(!gr(g,t))return!1;if(Ke(g))return s.$formatCells(h),!0;if(B(g)){let m=ue(g.anchor.getNode(),(_=>pe(_)));if(!pe(m))return!1}return!1}),Nt)),s.listenersToRemove.add(n.registerCommand(vf,(h=>{let g=z();if(!Ke(g)||!gr(g,t))return!1;let m=g.anchor.getNode(),_=g.focus.getNode();if(!pe(m)||!pe(_))return!1;if((function(w,S){if(Ke(w)){let N=w.anchor.getNode(),D=w.focus.getNode();if(S&&N&&D){let[O]=cn(S,N,D);return N.getKey()===O[0][0].cell.getKey()&&D.getKey()===O[O.length-1].at(-1).cell.getKey()}}return!1})(g,t))return t.setFormat(h),!0;let[b,y,v]=cn(t,m,_),x=Math.max(y.startRow+y.cell.__rowSpan-1,v.startRow+v.cell.__rowSpan-1),C=Math.max(y.startColumn+y.cell.__colSpan-1,v.startColumn+v.cell.__colSpan-1),E=Math.min(y.startRow,v.startRow),k=Math.min(y.startColumn,v.startColumn),T=new Set;for(let w=E;w<=x;w++)for(let S=k;S<=C;S++){let N=b[w][S].cell;if(T.has(N))continue;T.add(N),N.setFormat(h);let D=N.getChildren();for(let O=0;O<D.length;O++){let A=D[O];Y(A)&&!A.isInline()&&A.setFormat(h)}}return!0}),Nt)),s.listenersToRemove.add(n.registerCommand(_f,(h=>{let g=z();if(!gr(g,t))return!1;if(Ke(g))return s.$clearHighlight(),!1;if(B(g)){let m=ue(g.anchor.getNode(),(_=>pe(_)));if(!pe(m))return!1;if(typeof h=="string"){let _=qA(n,g,t);if(_)return YA(_,t,[kt(h)]),!0}}return!1}),Nt)),o&&s.listenersToRemove.add(n.registerCommand(Ri,(h=>{let g=z();if(!B(g)||!g.isCollapsed()||!gr(g,t))return!1;let m=_l(g.anchor.getNode());return!(m===null||!t.is(Us(m)))&&(qr(h),(function(_,b){let y=b==="next"?"getNextSibling":"getPreviousSibling",v=b==="next"?"getFirstChild":"getLastChild",x=_[y]();if(Y(x))return x.selectEnd();let C=ue(_,qe);C===null&&se(247);for(let k=C[y]();qe(k);k=k[y]()){let T=k[v]();if(Y(T))return T.selectEnd()}let E=ue(C,lt);E===null&&se(248),b==="next"?E.selectNext():E.selectPrevious()})(m,h.shiftKey?"previous":"next"),!0)}),Nt)),s.listenersToRemove.add(n.registerCommand(hO,(h=>t.isSelected()),Ai)),s.listenersToRemove.add(n.registerCommand(td,((h,g)=>{if(n!==g)return!1;let{nodes:m,selection:_}=h,b=_.getStartEndPoints(),y=Ke(_),v=B(_)&&ue(_.anchor.getNode(),(ee=>pe(ee)))!==null&&ue(_.focus.getNode(),(ee=>pe(ee)))!==null||y;if(m.length!==1||!lt(m[0])||!v||b===null)return!1;let[x,C]=b,[E,k,T]=Kt(x),w=ue(C.getNode(),(ee=>pe(ee)));if(!(pe(E)&&pe(w)&&qe(k)&&lt(T)))return!1;let S=m[0],[N,D,O]=cn(T,E,w),[A]=Jr(S,null,null),I=N.length,R=I>0?N[0].length:0,$=D.startRow,W=D.startColumn,P=A.length,q=P>0?A[0].length:0;if(y){let ee=eh(N,D,O),be=ee.maxRow-ee.minRow+1,Fe=ee.maxColumn-ee.minColumn+1;$=ee.minRow,W=ee.minColumn,P=Math.min(P,be),q=Math.min(q,Fe)}let ce=!1,rt=Math.min(I,$+P)-1,Et=Math.min(R,W+q)-1,_t=new Set;for(let ee=$;ee<=rt;ee++)for(let be=W;be<=Et;be++){let Fe=N[ee][be];_t.has(Fe.cell.getKey())||Fe.cell.__rowSpan===1&&Fe.cell.__colSpan===1||(iM(Fe.cell),_t.add(Fe.cell.getKey()),ce=!0)}let[dt]=Jr(T.getWritable(),null,null),ut=P-I+$;for(let ee=0;ee<ut;ee++)xv(dt[I-1][0].cell);let re=q-R+W;for(let ee=0;ee<re;ee++)vv(dt[0][R-1].cell,!0,!1);[dt]=Jr(T.getWritable(),null,null);for(let ee=$;ee<$+P;ee++)for(let be=W;be<W+q;be++){let Fe=ee-$,dn=be-W,Be=A[Fe][dn];if(Be.startRow!==Fe||Be.startColumn!==dn)continue;let nn=Be.cell;if(nn.__rowSpan!==1||nn.__colSpan!==1){let on=[],Cd=Math.min(ee+nn.__rowSpan,$+P)-1,Ed=Math.min(be+nn.__colSpan,W+q)-1;for(let H=ee;H<=Cd;H++)for(let ne=be;ne<=Ed;ne++){let Ce=dt[H][ne];on.push(Ce.cell)}rM(on),ce=!0}let{cell:Sl}=dt[ee][be],Th=Sl.getChildren();nn.getChildren().forEach((on=>{te(on)&&ge().append(on),Sl.append(on)})),Th.forEach((on=>on.remove()))}if(y&&ce){let[ee]=Jr(T.getWritable(),null,null);ee[D.startRow][D.startColumn].cell.selectEnd()}return!0}),Nt)),s.listenersToRemove.add(n.registerCommand(gn,(()=>{let h=z(),g=Kr(),m=s.getAndClearNextFocus();if(m!==null){let{focusCell:_}=m;if(Ke(h)&&h.tableKey===s.tableNodeKey)return(_.x!==s.focusX||_.y!==s.focusY)&&(s.$setFocusCellForSelection(_),!0);if(_!==s.anchorCell&&gr(h,t))return s.$setFocusCellForSelection(_),!0}if(s.getAndClearShouldCheckSelection()&&B(g)&&B(h)&&h.isCollapsed()){let _=h.anchor.getNode(),b=t.getFirstChild(),y=_l(_);if(y!==null&&qe(b)){let v=b.getFirstChild();if(pe(v)&&t.is(ue(y,(x=>x.is(t)||x.is(v)))))return v.selectStart(),!0}}if(B(h)){let{anchor:_,focus:b}=h,y=_.getNode(),v=b.getNode(),x=_l(y),C=_l(v),E=!(!x||!t.is(Us(x))),k=!(!C||!t.is(Us(C))),T=E!==k,w=E&&k,S=h.isBackward();if(T){let N=h.clone();if(k){let[D]=cn(t,C,C),O=D[0][0].cell,A=D[D.length-1].at(-1).cell;N.focus.set(S?O.getKey():A.getKey(),S?O.getChildrenSize():A.getChildrenSize(),"element")}else if(E){let[D]=cn(t,x,x),O=D[0][0].cell,A=D[D.length-1].at(-1).cell;N.anchor.set(S?A.getKey():O.getKey(),S?A.getChildrenSize():0,"element")}vt(N),GA(n,s)}else if(w&&(x.is(C)||(s.$setAnchorCellForSelection(Hs(s,x)),s.$setFocusCellForSelection(Hs(s,C),!0)),s.pointerType==="touch"&&s.isSelecting&&h.isCollapsed()&&B(g)&&g.isCollapsed())){let N=_l(g.anchor.getNode());N&&!N.is(C)&&(s.$setAnchorCellForSelection(Hs(s,N)),s.$setFocusCellForSelection(Hs(s,C),!0),s.pointerType=null)}}else if(h&&Ke(h)&&h.is(g)&&h.tableKey===t.getKey()){let _=so(i);if(_&&_.anchorNode&&_.focusNode){let b=ln(_.focusNode),y=b&&!t.isParentOf(b),v=ln(_.anchorNode),x=v&&t.isParentOf(v);if(y&&x&&_.rangeCount>0){let C=qD(_,n);C&&(C.anchor.set(t.getKey(),h.isBackward()?t.getChildrenSize():0,"element"),_.removeAllRanges(),vt(C))}}}return h&&!h.is(g)&&(Ke(h)||Ke(g))&&s.tableSelection&&!s.tableSelection.is(g)?(Ke(h)&&h.tableKey===s.tableNodeKey?s.$updateTableTableSelection(h):!Ke(h)&&Ke(g)&&g.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!t.isSelected()?(function(_,b){b.$enableHighlightStyle(),Lv(b.table,(y=>{let v=y.elem;y.highlighted=!1,cM(_,y),v.getAttribute("style")||v.removeAttribute("style")}))})(n,s):!s.hasHijackedSelectionStyles&&t.isSelected()&&GA(n,s),!1)}),Nt)),s.listenersToRemove.add(n.registerCommand(Mi,(()=>{let h=z();if(!B(h)||!h.isCollapsed()||!gr(h,t))return!1;let g=qA(n,h,t);return!!g&&(YA(g,t),!0)}),Nt)),s}function wv(t){return t[Ev]||null}function _d(t){let e=t;for(;e!=null;){let n=e.nodeName;if(n==="TD"||n==="TH"){let o=e._cell;return o===void 0?null:o}e=e.parentNode}return null}function WA(t,e){if(!t.contains(e))return null;let n=null;for(let o=e;o!=null;o=o.parentNode){if(o===t)return n;let r=o.nodeName;r!=="TD"&&r!=="TH"||(n=o._cell||null)}return null}function bl(t,e){let n=[],o={columns:0,domRows:n,rows:0},r=Ui(t,e).querySelector("tr"),i=0,s=0;for(n.length=0;r!=null;){let a=r.nodeName;if(a==="TD"||a==="TH"){let d={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:i,y:s};r._cell=d;let u=n[s];u===void 0&&(u=n[s]=[]),u[i]=d}else{let d=r.firstChild;if(d!=null){r=d;continue}}let l=r.nextSibling;if(l!=null){i++,r=l;continue}let c=r.parentNode;if(c!=null){let d=c.nextSibling;if(d==null)break;s++,i=0,r=d}}return o.columns=i+1,o.rows=s+1,o}function Xf(t,e,n){let o=new Set(n?n.getNodes():[]);Lv(e,((r,i)=>{let s=r.elem;o.has(i)?(r.highlighted=!0,lM(t,r)):(r.highlighted=!1,cM(t,r),s.getAttribute("style")||s.removeAttribute("style"))}))}function Lv(t,e){let{domRows:n}=t;for(let o=0;o<n.length;o++){let r=n[o];if(r)for(let i=0;i<r.length;i++){let s=r[i];if(!s)continue;let a=ln(s.elem);a!==null&&e(s,a,{x:i,y:o})}}}function GA(t,e){e.$disableHighlightStyle(),Lv(e.table,(n=>{n.highlighted=!0,lM(t,n)}))}var j8=(t,e,n,o,r)=>{let i=r==="forward";switch(r){case"backward":case"forward":return n!==(i?t.table.columns-1:0)?Qf(e.getCellNodeFromCordsOrThrow(n+(i?1:-1),o,t.table),i):o!==(i?t.table.rows-1:0)?Qf(e.getCellNodeFromCordsOrThrow(i?0:t.table.columns-1,o+(i?1:-1),t.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return o!==0?Qf(e.getCellNodeFromCordsOrThrow(n,o-1,t.table),!1):e.selectPrevious(),!0;case"down":return o!==t.table.rows-1?Qf(e.getCellNodeFromCordsOrThrow(n,o+1,t.table),!0):e.selectNext(),!0;default:return!1}};function _v(t,e){let n,o;if(e.startColumn===t.minColumn)n="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==t.maxColumn)return null;n="maxColumn"}if(e.startRow===t.minRow)o="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==t.maxRow)return null;o="maxRow"}return[n,o]}function Zf([t,e]){return[t==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function gl(t,e,[n,o]){let r=e[o],i=t[r];i===void 0&&se(250,o,String(r));let s=e[n],a=i[s];return a===void 0&&se(250,n,String(s)),a}function V8(t,e,n,o,r){let i=eh(e,n,o),s=(function(E,k){let{minColumn:T,maxColumn:w,minRow:S,maxRow:N}=k,D=1,O=1,A=1,I=1,R=E[S],$=E[N];for(let W=T;W<=w;W++)D=Math.max(D,R[W].cell.__rowSpan),I=Math.max(I,$[W].cell.__rowSpan);for(let W=S;W<=N;W++)O=Math.max(O,E[W][T].cell.__colSpan),A=Math.max(A,E[W][w].cell.__colSpan);return{bottomSpan:I,leftSpan:O,rightSpan:A,topSpan:D}})(e,i),{topSpan:a,leftSpan:l,bottomSpan:c,rightSpan:d}=s,u=(function(E,k){let T=_v(E,k);return T===null&&se(249,k.cell.getKey()),T})(i,n),[p,h]=Zf(u),g=i[p],m=i[h];r==="forward"?g+=p==="maxColumn"?1:l:r==="backward"?g-=p==="minColumn"?1:d:r==="down"?m+=h==="maxRow"?1:a:r==="up"&&(m-=h==="minRow"?1:c);let _=e[m];if(_===void 0)return!1;let b=_[g];if(b===void 0)return!1;let[y,v]=(function(E,k,T){let w=eh(E,k,T),S=_v(w,k);if(S)return[gl(E,w,S),gl(E,w,Zf(S))];let N=_v(w,T);if(N)return[gl(E,w,Zf(N)),gl(E,w,N)];let D=["minColumn","minRow"];return[gl(E,w,D),gl(E,w,Zf(D))]})(e,n,b),x=Hs(t,y.cell),C=Hs(t,v.cell);return t.$setAnchorCellForSelection(x),t.$setFocusCellForSelection(C,!0),!0}function gr(t,e){if(B(t)||Ke(t)){let n=e.isParentOf(t.anchor.getNode()),o=e.isParentOf(t.focus.getNode());return n&&o}return!1}function Qf(t,e){e?t.selectStart():t.selectEnd()}function lM(t,e){let n=e.elem,o=t._config.theme;pe(ln(n))||se(131),Ye(n,o.tableCellSelected)}function cM(t,e){let n=e.elem;pe(ln(n))||se(131);let o=t._config.theme;Wn(n,o.tableCellSelected)}function _l(t){let e=ue(t,pe);return pe(e)?e:null}function Us(t){let e=ue(t,lt);return lt(e)?e:null}function W8(t,e,n,o,r,i,s){let a=Ni(n.focus,r?"previous":"next");if(uf(a))return!1;let l=a;for(let _ of Xc(a).iterNodeCarets("shadowRoot")){if(!pf(_)||!Y(_.origin))return!1;l=_}let c=l.getParentAtCaret();if(!pe(c))return!1;let d=c,u=(function(_){for(let b of Xc(_).iterNodeCarets("root")){let{origin:y}=b;if(pe(y)){if(Oi(b))return io(y,_.direction)}else if(!qe(y))break}return null})(Nn(d,l.direction)),p=ue(d,lt);if(!p||!p.is(i))return!1;let h=t.getElementByKey(d.getKey()),g=_d(h);if(!h||!g)return!1;let m=uM(t,p);if(s.table=m,u)if(o==="extend"){let _=_d(t.getElementByKey(u.origin.getKey()));if(!_)return!1;s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(_,!0)}else{let _=lr(u);Ii(n.anchor,_),Ii(n.focus,_)}else if(o==="extend")s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(g,!0);else{let _=(function(b){let y=Ds(b);return Oi(y)?lr(y):b})(Nn(p,a.direction));Ii(n.anchor,_),Ii(n.focus,_)}return qr(e),!0}function dM(t,e,n,o,r){if((n==="up"||n==="down")&&(function(s){let a=s.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1})(t))return!1;let i=z();if(!gr(i,o)){if(B(i)){if(n==="backward"){if(i.focus.offset>0)return!1;let s=(function(l){for(let c=l,d=l;d!==null;c=d,d=d.getParent())if(Y(d)){if(d!==c&&d.getFirstChild()!==c)return null;if(!d.isInline())return d}return null})(i.focus.getNode());if(!s)return!1;let a=s.getPreviousSibling();return!!lt(a)&&(qr(e),e.shiftKey?i.focus.set(a.getParentOrThrow().getKey(),a.getIndexWithinParent(),"element"):a.selectEnd(),!0)}if(e.shiftKey&&(n==="up"||n==="down")){let s=i.focus.getNode();if(!i.isCollapsed()&&(n==="up"&&!i.isBackward()||n==="down"&&i.isBackward())){let a=ue(s,(p=>lt(p)));if(pe(a)&&(a=ue(a,lt)),a!==o||!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(!l)return!1;let c=0;n==="up"&&Y(l)&&(c=l.getChildrenSize());let d=l;n==="up"&&Y(l)&&(d=l.getLastChild()||l,c=te(d)?d.getTextContentSize():0);let u=i.clone();return u.focus.set(d.getKey(),c,te(d)?"text":"element"),vt(u),qr(e),!0}if(zt(s)){let a=n==="up"?i.getNodes()[i.getNodes().length-1]:i.getNodes()[0];if(a&&gd(o,a)!==null){let l=o.getFirstDescendant(),c=o.getLastDescendant();if(!l||!c)return!1;let[d]=Kt(l),[u]=Kt(c),p=o.getCordsFromCellNode(d,r.table),h=o.getCordsFromCellNode(u,r.table),g=o.getDOMCellFromCordsOrThrow(p.x,p.y,r.table),m=o.getDOMCellFromCordsOrThrow(h.x,h.y,r.table);return r.$setAnchorCellForSelection(g),r.$setFocusCellForSelection(m,!0),!0}return!1}{let a=ue(s,(c=>Y(c)&&!c.isInline()));if(pe(a)&&(a=ue(a,lt)),!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(lt(l)&&r.tableNodeKey===l.getKey()){let c=l.getFirstDescendant(),d=l.getLastDescendant();if(!c||!d)return!1;let[u]=Kt(c),[p]=Kt(d),h=i.clone();return h.focus.set((n==="up"?u:p).getKey(),n==="up"?0:p.getChildrenSize(),"element"),qr(e),vt(h),!0}}}}return n==="down"&&oh(t)&&r.setShouldCheckSelection(),!1}if(B(i)){if(n==="backward"||n==="forward")return W8(t,e,i,e.shiftKey?"extend":"move",n==="backward",o,r);if(i.isCollapsed()){let{anchor:s,focus:a}=i,l=ue(s.getNode(),pe),c=ue(a.getNode(),pe);if(!pe(l)||!l.is(c))return!1;let d=Us(l);if(d!==o&&d!=null){let b=Ui(d,t.getElementByKey(d.getKey()));if(b!=null)return r.table=bl(d,b),dM(t,e,n,d,r)}let u=t.getElementByKey(l.__key),p=t.getElementByKey(s.key);if(p==null||u==null)return!1;let h;if(s.type==="element")h=p.getBoundingClientRect();else{let b=so(Mv(t));if(b===null||b.rangeCount===0)return!1;h=b.getRangeAt(0).getBoundingClientRect()}let g=n==="up"?l.getFirstChild():l.getLastChild();if(g==null)return!1;let m=t.getElementByKey(g.__key);if(m==null)return!1;let _=m.getBoundingClientRect();if(n==="up"?_.top>h.top-h.height:h.bottom+h.height>_.bottom){qr(e);let b=o.getCordsFromCellNode(l,r.table);if(!e.shiftKey)return j8(r,o,b.x,b.y,n);{let y=o.getDOMCellFromCordsOrThrow(b.x,b.y,r.table);r.$setAnchorCellForSelection(y),r.$setFocusCellForSelection(y,!0)}return!0}}}else if(Ke(i)){let{anchor:s,focus:a}=i,l=ue(s.getNode(),pe),c=ue(a.getNode(),pe),[d]=i.getNodes();lt(d)||se(251);let u=Ui(d,t.getElementByKey(d.getKey()));if(!pe(l)||!pe(c)||!lt(d)||u==null)return!1;r.$updateTableTableSelection(i);let p=bl(d,u),h=o.getCordsFromCellNode(l,p),g=o.getDOMCellFromCordsOrThrow(h.x,h.y,p);if(r.$setAnchorCellForSelection(g),qr(e),e.shiftKey){let[m,_,b]=cn(o,l,c);return V8(r,m,_,b,n)}return c.selectEnd(),!0}return!1}function qr(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation()}function YA(t,e,n){let o=ge();t==="first"?e.insertBefore(o):e.insertAfter(o),o.append(...n||[]),o.selectEnd()}function qA(t,e,n){let o=n.getParent();if(!o)return;let r=so(Mv(t));if(!r)return;let i=r.anchorNode,s=t.getElementByKey(o.getKey()),a=Ui(n,t.getElementByKey(n.getKey()));if(!i||!s||!a||!s.contains(i)||a.contains(i))return;let l=ue(e.anchor.getNode(),(y=>pe(y)));if(!l)return;let c=ue(l,(y=>lt(y)));if(!lt(c)||!c.is(n))return;let[d,u]=cn(n,l,l),p=d[0][0],h=d[d.length-1][d[0].length-1],{startRow:g,startColumn:m}=u,_=g===p.startRow&&m===p.startColumn,b=g===h.startRow&&m===h.startColumn;return _?"first":b?"last":void 0}function Hs(t,e){let{tableNode:n}=t.$lookup(),o=n.getCordsFromCellNode(e,t.table);return n.getDOMCellFromCordsOrThrow(o.x,o.y,t.table)}function Tv(t,e,n){return gd(t,ln(e,n))}function JA(t,e,n){if(!e.theme.tableAlignment)return;let o=[],r=[];for(let i of["center","right"]){let s=e.theme.tableAlignment[i];s&&(i===n?r:o).push(s)}Wn(t,...o),Ye(t,...r)}var Sv=new WeakSet;function oh(t=Os()){return Sv.has(t)}function G8(t,e){e?Sv.add(t):Sv.delete(t)}var Ki=class t extends Ht{static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let n=this.getWritable();return n.__colWidths=e,n}static clone(e){return new t(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Y8,priority:1})}}static importJSON(e){return ih().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,n,o){return o==="html"}getDOMSlot(e){let n=ml(e)?e:e.querySelector("table");return ml(n)||se(229),super.getDOMSlot(e).withElement(n).withAfter(n.querySelector("colgroup"))}createDOM(e,n){let o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);let r=document.createElement("colgroup");if(o.appendChild(r),LO(r),Ye(o,e.theme.table),this.updateTableElement(null,o,e),oh(n)){let i=document.createElement("div"),s=e.theme.tableScrollableWrapper;return s?Ye(i,s):i.style.cssText="overflow-x: auto;",i.appendChild(o),this.updateTableWrapper(null,i,o,e),i}return o}updateTableWrapper(e,n,o,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(i,s,a,l){l>0?(Ye(i,a.theme.tableFrozenColumn),s.setAttribute("data-lexical-frozen-column","true")):(Wn(i,a.theme.tableFrozenColumn),s.removeAttribute("data-lexical-frozen-column"))})(n,o,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(i,s,a,l){l>0?(Ye(i,a.theme.tableFrozenRow),s.setAttribute("data-lexical-frozen-row","true")):(Wn(i,a.theme.tableFrozenRow),s.removeAttribute("data-lexical-frozen-row"))})(n,o,r,this.__frozenRowCount)}updateTableElement(e,n,o){this.__style!==(e?e.__style:"")&&(n.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(r,i,s){s?(Ye(r,i.theme.tableRowStriping),r.setAttribute("data-lexical-row-striping","true")):(Wn(r,i.theme.tableRowStriping),r.removeAttribute("data-lexical-row-striping"))})(n,o,this.__rowStriping),(function(r,i,s,a){let l=r.querySelector("colgroup");if(!l)return;let c=[];for(let d=0;d<s;d++){let u=document.createElement("col"),p=a&&a[d];p&&(u.style.width=`${p}px`),c.push(u)}l.replaceChildren(...c)})(n,0,this.getColumnCount(),this.getColWidths()),JA(n,o,this.getFormatType())}updateDOM(e,n,o){let r=this.getDOMSlot(n).element;return n===r===oh()||(en(i=n)&&i.nodeName==="DIV"&&this.updateTableWrapper(e,n,r,o),this.updateTableElement(e,r,o),!1);var i}exportDOM(e){let n=super.exportDOM(e),{element:o}=n;return{after:r=>{if(n.after&&(r=n.after(r)),!ml(r)&&en(r)&&(r=r.querySelector("table")),!ml(r))return null;JA(r,e._config,this.getFormatType());let[i]=Jr(this,null,null),s=new Map;for(let d of i)for(let u of d){let p=u.cell.getKey();s.has(p)||s.set(p,{colSpan:u.cell.getColSpan(),startColumn:u.startColumn})}let a=new Set;for(let d of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){let u=d.getAttribute("data-temporary-table-cell-lexical-key");if(u){let p=s.get(u);if(d.removeAttribute("data-temporary-table-cell-lexical-key"),p){s.delete(u);for(let h=0;h<p.colSpan;h++)a.add(h+p.startColumn)}}}let l=r.querySelector(":scope > colgroup");if(l){let d=Array.from(r.querySelectorAll(":scope > colgroup > col")).filter(((u,p)=>a.has(p)));l.replaceChildren(...d)}let c=r.querySelectorAll(":scope > tr");if(c.length>0){let d=document.createElement("tbody");for(let u of c)d.appendChild(u);r.append(d)}return r},element:!ml(o)&&en(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,n){let{rows:o,domRows:r}=n;for(let i=0;i<o;i++){let s=r[i];if(s!=null)for(let a=0;a<s.length;a++){let l=s[a];if(l==null)continue;let{elem:c}=l,d=Tv(this,c);if(d!==null&&e.is(d))return{x:a,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,n,o){let{domRows:r}=o,i=r[n];if(i==null)return null;let s=i[e<i.length?e:i.length-1];return s??null}getDOMCellFromCordsOrThrow(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(r==null)return null;let i=ln(r.elem);return pe(i)?i:null}getCellNodeFromCordsOrThrow(e,n,o){let r=this.getCellNodeFromCords(e,n,o);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let n=this.getWritable();return n.__rowStriping=e,n}setFrozenColumns(e){let n=this.getWritable();return n.__frozenColumnCount=e,n}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let n=this.getWritable();return n.__frozenRowCount=e,n}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!e)return 0;let n=0;return e.getChildren().forEach((o=>{pe(o)&&(n+=o.getColSpan())})),n}};function uM(t,e){let n=t.getElementByKey(e.getKey());return n===null&&se(230),bl(e,n)}function Y8(t){let e=ih();t.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),t.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),t.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);let n=t.querySelector(":scope > colgroup");if(n){let o=[];for(let r of n.querySelectorAll(":scope > col")){let i=r.style.width||"";if(!kv.test(i)&&(i=r.getAttribute("width")||"",!/^\d+$/.test(i))){o=void 0;break}o.push(parseFloat(i))}o&&e.setColWidths(o)}return{after:o=>kx(o,qe),node:e}}function ih(){return At(new Ki)}function lt(t){return t instanceof Ki}function q8({rows:t,columns:e,includeHeaders:n}){let o=z()||Kr();if(!o||!B(o)||Us(o.anchor.getNode()))return!1;let r=ZA(Number(t),Number(e),n);Lf(r);let i=r.getFirstDescendant();return te(i)&&i.select(),!0}function J8(t){qe(t.getParent())?t.isEmpty()&&t.append(ge()):t.remove()}function X8(t){lt(t.getParent())?Nx(t,pe):t.remove()}function Z8(t){Nx(t,qe);let[e]=Jr(t,null,null),n=e.reduce(((r,i)=>Math.max(r,i.length)),0),o=t.getChildren();for(let r=0;r<e.length;++r){let i=o[r];if(!i)continue;qe(i)||se(254,i.constructor.name,i.getType());let s=e[r].reduce(((a,l)=>l?1+a:a),0);if(s!==n)for(let a=s;a<n;++a){let l=qn();l.append(ge()),i.append(l)}}}function Q8(t){if(t.detail<3||!Fi(t.target))return!1;let e=ln(t.target);if(e===null)return!1;let n=ue(e,(o=>Y(o)&&!o.isInline()));return n===null?!1:!!pe(n.getParent())&&(n.select(0),!0)}function eW(t){return t.registerNodeTransform(Hi,(e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,n]=Kt(e),[o]=cn(n,e,e),r=o.length,i=o[0].length,s=n.getFirstChild();qe(s)||se(175);let a=[];for(let l=0;l<r;l++){l!==0&&(s=s.getNextSibling(),qe(s)||se(175));let c=null;for(let d=0;d<i;d++){let u=o[l][d],p=u.cell;if(u.startRow===l&&u.startColumn===d)c=p,a.push(p);else if(p.getColSpan()>1||p.getRowSpan()>1){pe(p)||se(176);let h=qn(p.__headerState);c!==null?c.insertAfter(h):gI(s,h)}}}for(let l of a)l.setColSpan(1),l.setRowSpan(1)}}))}function tW(t,e=!0){let n=new Map,o=(i,s,a)=>{let l=Ui(i,a),c=aM(i,l,t,e);n.set(s,[c,l])},r=t.registerMutationListener(Ki,(i=>{t.getEditorState().read((()=>{for(let[s,a]of i){let l=n.get(s);if(a==="created"||a==="updated"){let{tableNode:c,tableElement:d}=Av(s);l===void 0?o(c,s,d):d!==l[1]&&(l[0].removeListeners(),n.delete(s),o(c,s,d))}else a==="destroyed"&&l!==void 0&&(l[0].removeListeners(),n.delete(s))}}),{editor:t})}),{skipInitialization:!1});return()=>{r();for(let[,[i]]of n)i.removeListeners()}}function nW(t){return t.hasNodes([Ki])||se(255),He(t.registerCommand(XA,q8,Te),t.registerCommand(td,(({nodes:e,selection:n},o)=>t!==o||!B(n)?!1:Us(n.anchor.getNode())!==null&&e.some(lt)),Te),t.registerCommand(cr,Q8,Te),t.registerNodeTransform(Ki,Z8),t.registerNodeTransform(yl,X8),t.registerNodeTransform(Hi,J8))}var he=Rv,yse=he.$computeTableMap,xse=he.$computeTableMapSkipCellCheck,pM=he.$createTableCellNode,fM=he.$createTableNode,vse=he.$createTableNodeWithDimensions,hM=he.$createTableRowNode,Cse=he.$createTableSelection,Ese=he.$createTableSelectionFrom,wse=he.$deleteTableColumn,gM=he.$deleteTableColumnAtSelection,Tse=he.$deleteTableColumn__EXPERIMENTAL,mM=he.$deleteTableRowAtSelection,Sse=he.$deleteTableRow__EXPERIMENTAL,kse=he.$findCellNode,Nse=he.$findTableNode,Dse=he.$getElementForTableNode,Ose=he.$getNodeTriplet,Ise=he.$getTableAndElementByKey,Pv=he.$getTableCellNodeFromLexicalNode,Ase=he.$getTableCellNodeRect,Mse=he.$getTableColumnIndexFromTableCellNode,bd=he.$getTableNodeFromLexicalNodeOrThrow,Lse=he.$getTableRowIndexFromTableCellNode,Rse=he.$getTableRowNodeFromTableCellNodeOrThrow,Pse=he.$insertTableColumn,Fv=he.$insertTableColumnAtSelection,Fse=he.$insertTableColumn__EXPERIMENTAL,Bse=he.$insertTableRow,Bv=he.$insertTableRowAtSelection,$se=he.$insertTableRow__EXPERIMENTAL,_M=he.$isScrollableTablesActive,Ko=he.$isTableCellNode,bM=he.$isTableNode,wo=he.$isTableRowNode,yM=he.$isTableSelection,zse=he.$mergeCells,Hse=he.$removeTableRowAtIndex,Use=he.$unmergeCell,xM=he.INSERT_TABLE_COMMAND,On=he.TableCellHeaderStates,sh=he.TableCellNode,ah=he.TableNode,Kse=he.TableObserver,vM=he.TableRowNode,jse=he.applyTableHandlers,Vse=he.getDOMCellFromTarget,Wse=he.getTableElement,Gse=he.getTableObserverFromTableElement,CM=he.registerTableCellUnmergeTransform,EM=he.registerTablePlugin,wM=he.registerTableSelectionObserver,TM=he.setScrollableTablesActive;var $v={};$e($v,{TablePlugin:()=>oW});bt();function oW({hasCellMerge:t=!0,hasCellBackgroundColor:e=!0,hasTabHandler:n=!0,hasHorizontalScroll:o=!1}){let[r]=ve();return F((()=>{_M(r)!==o&&(TM(r,o),r.registerNodeTransform(ah,(()=>{}))())}),[r,o]),F((()=>EM(r)),[r]),F((()=>wM(r,n)),[r,n]),F((()=>{if(!t)return CM(r)}),[r,t]),F((()=>{if(!e)return r.registerNodeTransform(sh,(i=>{i.getBackgroundColor()!==null&&i.setBackgroundColor(null)}))}),[r,e,t]),null}var rW=$v,SM=rW.TablePlugin;Se();function zv(t){return{type:"string",...t}}function kM(t){return{type:"image",...t}}function iW(t){return t}var Hv=iW;var DM=new Set(["paragraph","heading","quote","orderedList","unorderedList","table","delimiter"]),NM=40,aW=200,jv="root:openRichTextBlock",Vv="root:openRichTextInline";function Qse(t,e,n,o={}){let r=(t||"").trim();if(!r)return[];let i={query:r,queryLower:r.toLowerCase(),results:[],types:o},s=[];for(Uv(s,i,n,e,"fields",[]);s.length>0&&i.results.length<aW;)s.shift()();return i.results}function Uv(t,e,n,o,r,i){if(o)for(let s of n){if(!s.id||s.hidden)continue;let a=o[s.id],l=`${r}.${s.id}`,c=s.label||s.id;t.push(()=>OM(t,e,s,a,l,[...i,c]))}}function OM(t,e,n,o,r,i){if(o!=null)switch(n.type){case"object":{Uv(t,e,n.fields||[],o,r,i);return}case"array":{let s=n;(o?._array||[]).forEach((l,c)=>{let d=o?.[l];if(d==null)return;let u=`[${c}]`,p=s.of;t.push(()=>OM(t,e,p,d,`${r}.${l}`,[...i,u]))});return}case"oneof":{let s=n,a=o?._type;if(!a)return;let l=s.types||[],c;if(typeof l[0]=="string"?l.includes(a)&&(c=e.types[a]):c=l.find(d=>d?.name===a),!c)return;Uv(t,e,c.fields||[],o,r,[...i.slice(0,-1),`${i.at(-1)} (${a})`]);return}case"string":{typeof o=="string"&&mn(e,o,n.type,r,i);return}case"select":{typeof o=="string"&&mn(e,o,n.type,r,i);return}case"multiselect":{if(Array.isArray(o)){let s=o.filter(a=>typeof a=="string").join(", ");s&&mn(e,s,n.type,r,i)}return}case"number":{typeof o=="number"&&mn(e,String(o),n.type,r,i);return}case"boolean":return;case"date":case"datetime":{typeof o=="string"&&mn(e,o,n.type,r,i);return}case"image":case"file":{if(o&&typeof o=="object"){let s=[];typeof o.alt=="string"&&s.push(o.alt),typeof o.filename=="string"&&s.push(o.filename),typeof o.src=="string"&&s.push(o.src),s.length>0&&mn(e,s.join(" "),n.type,r,i)}return}case"reference":{o&&typeof o=="object"&&typeof o.id=="string"&&mn(e,o.id,n.type,r,i);return}case"references":{if(Array.isArray(o)){let s=o.map(a=>a&&typeof a=="object"?a.id:null).filter(a=>typeof a=="string").join(", ");s&&mn(e,s,n.type,r,i)}return}case"richtext":{IM(e,n,o,r,i);return}default:return}}function IM(t,e,n,o,r){if(!n||!Array.isArray(n.blocks))return;let i=new Map;(e.blockComponents||[]).forEach(a=>{a?.name&&i.set(a.name,a)});let s=-1;n.blocks.forEach(a=>{if(!a?.type)return;if(DM.has(a.type)){MM(t,a,o,r);return}s+=1;let l=s,c={block:{richTextDeepKey:o,blockIndex:l,blockName:a.type}},d=i.get(a.type);if(!d){lh(t,a.data,o,[...r,`${a.type} [block ${l}]`],c);return}let u=[...r,`${d.label||d.name} [block ${l}]`];Kv(t,d.fields||[],a.data||{},o,u,c)})}function Kv(t,e,n,o,r,i){for(let s of e){if(!s.id||s.hidden)continue;let a=n?.[s.id];if(a==null)continue;let l=[...r,s.label||s.id];AM(t,s,a,o,l,i)}}function AM(t,e,n,o,r,i){switch(e.type){case"object":{Kv(t,e.fields||[],n,o,r,i);return}case"array":{let s=e;(n?._array||[]).forEach((l,c)=>{let d=n?.[l];d!=null&&AM(t,s.of,d,o,[...r,`[${c}]`],i)});return}case"oneof":{let s=e,a=n?._type;if(!a)return;let l=s.types||[],c;typeof l[0]=="string"?l.includes(a)&&(c=t.types[a]):c=l.find(d=>d?.name===a),c&&Kv(t,c.fields||[],n,o,[...r.slice(0,-1),`${r.at(-1)} (${a})`],i);return}case"string":case"select":{typeof n=="string"&&mn(t,n,e.type,o,r,i);return}case"multiselect":{if(Array.isArray(n)){let s=n.filter(a=>typeof a=="string").join(", ");s&&mn(t,s,e.type,o,r,i)}return}case"number":{typeof n=="number"&&mn(t,String(n),e.type,o,r,i);return}case"image":case"file":{if(n&&typeof n=="object"){let s=[];typeof n.alt=="string"&&s.push(n.alt),typeof n.filename=="string"&&s.push(n.filename),typeof n.src=="string"&&s.push(n.src),s.length>0&&mn(t,s.join(" "),e.type,o,r,i)}return}case"richtext":{IM(t,e,n,o,r);return}default:return}}function lh(t,e,n,o,r){if(e!=null){if(typeof e=="string"){mn(t,e,"string",n,o,r);return}if(typeof e=="number"){mn(t,String(e),"number",n,o,r);return}if(Array.isArray(e)){e.forEach((i,s)=>lh(t,i,n,[...o,`[${s}]`],r));return}if(typeof e=="object")for(let i of Object.keys(e))i.startsWith("_")||lh(t,e[i],n,[...o,i],r)}}function MM(t,e,n,o){switch(e.type){case"heading":case"paragraph":{let r=PM(e.data?.text);r&&mn(t,r,"richtext",n,[...o,e.type]),RM(t,e.data?.components,n,o);return}case"orderedList":case"unorderedList":{LM(t,e.data?.items,n,[...o,e.type]);return}case"table":{(e.data?.rows||[]).forEach((i,s)=>{(i.cells||[]).forEach((a,l)=>{(a.blocks||[]).forEach(c=>{DM.has(c.type)&&MM(t,c,n,[...o,`table [${s},${l}]`])})})});return}default:return}}function LM(t,e,n,o){e&&e.forEach((r,i)=>{let s=PM(r.content);s&&mn(t,s,"richtext",n,[...o,`[${i}]`]),RM(t,r.components,n,o),LM(t,r.items,n,[...o,`[${i}]`])})}function RM(t,e,n,o){if(e)for(let r of Object.keys(e)){let i=e[r];if(!i?.type)continue;let s={inline:{richTextDeepKey:n,componentId:r,componentName:i.type}};lh(t,i?.data,n,[...o,`inline:${i.type}`],s)}}function PM(t){return t?t.replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim():""}function mn(t,e,n,o,r,i){if(!e||e.toLowerCase().indexOf(t.queryLower)===-1)return;let{snippet:l,matches:c}=lW(e,t.queryLower);t.results.push({deepKey:o,label:r.join(" \u203A "),snippet:l,matches:c,fieldType:n,richTextBlock:i?.block,richTextInline:i?.inline})}function lW(t,e){let n=t.toLowerCase(),o=e.length,r=n.indexOf(e);if(r===-1)return{snippet:t,matches:[]};let i=Math.max(0,r-NM),s=Math.min(t.length,r+o+NM),a=i>0?"\u2026":"",l=s<t.length?"\u2026":"",c=t.slice(i,s),d=`${a}${c}${l}`,u=[],p=c.toLowerCase(),h=0;for(;h<p.length;){let g=p.indexOf(e,h);if(g===-1)break;u.push({start:g+a.length,end:g+a.length+o}),h=g+o}return{snippet:d,matches:u}}ri();Se();var FM=pt({blocks:new Map});function BM(t){return f(FM.Provider,{value:{blocks:t.blocks,onEditBlock:t.onEditBlock},children:t.children})}function $M(){return ft(FM)}ri();Se();var zM=pt({components:new Map});function HM(t){return f(zM.Provider,{value:{components:t.components,onEditComponent:t.onEditComponent},children:t.children})}function UM(){return ft(zM)}ri();Se();var KM=pt({});function jM(t){let e=X(()=>({historyState:dA()}),[]);return f(KM.Provider,{value:e,children:t.children})}function VM(){return ft(KM)}ri();Se();var ch={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",bullet:"Bulleted List",number:"Numbered List",quote:"Quote"},cW={blockType:"paragraph",canRedo:!1,canUndo:!1,codeLanguage:"",elementFormat:"left",isBold:!1,isCode:!1,isHighlight:!1,isImageCaption:!1,isItalic:!1,isLink:!1,isRTL:!1,isStrikethrough:!1,isSubscript:!1,isSuperscript:!1,isUnderline:!1,isLowercase:!1,isUppercase:!1,isCapitalize:!1,rootType:"root"},WM=pt(void 0);function GM(t){let[e,n]=L(cW),o=Ne((i,s)=>{n(a=>({...a,[i]:s}))},[]),r=X(()=>({toolbarState:e,updateToolbarState:o}),[e,o]);return f(WM.Provider,{value:r,children:t.children})}function dh(){let t=ft(WM);if(t===void 0)throw new Error("useToolbar must be used within a ToolbarProvider");return t}var YM={autocomplete:"LexicalTheme__autocomplete",blockCursor:"LexicalTheme__blockCursor",characterLimit:"LexicalTheme__characterLimit",code:"LexicalTheme__code",codeHighlight:{atrule:"LexicalTheme__tokenAttr",attr:"LexicalTheme__tokenAttr",boolean:"LexicalTheme__tokenProperty",builtin:"LexicalTheme__tokenSelector",cdata:"LexicalTheme__tokenComment",char:"LexicalTheme__tokenSelector",class:"LexicalTheme__tokenFunction","class-name":"LexicalTheme__tokenFunction",comment:"LexicalTheme__tokenComment",constant:"LexicalTheme__tokenProperty",deleted:"LexicalTheme__tokenProperty",doctype:"LexicalTheme__tokenComment",entity:"LexicalTheme__tokenOperator",function:"LexicalTheme__tokenFunction",important:"LexicalTheme__tokenVariable",inserted:"LexicalTheme__tokenSelector",keyword:"LexicalTheme__tokenAttr",namespace:"LexicalTheme__tokenVariable",number:"LexicalTheme__tokenProperty",operator:"LexicalTheme__tokenOperator",prolog:"LexicalTheme__tokenComment",property:"LexicalTheme__tokenProperty",punctuation:"LexicalTheme__tokenPunctuation",regex:"LexicalTheme__tokenVariable",selector:"LexicalTheme__tokenSelector",string:"LexicalTheme__tokenSelector",symbol:"LexicalTheme__tokenProperty",tag:"LexicalTheme__tokenProperty",url:"LexicalTheme__tokenOperator",variable:"LexicalTheme__tokenVariable"},embedBlock:{base:"LexicalTheme__embedBlock",focus:"LexicalTheme__embedBlockFocus"},hashtag:"LexicalTheme__hashtag",heading:{h1:"LexicalTheme__h1",h2:"LexicalTheme__h2",h3:"LexicalTheme__h3",h4:"LexicalTheme__h4",h5:"LexicalTheme__h5",h6:"LexicalTheme__h6"},hr:"LexicalTheme__hr",hrSelected:"LexicalTheme__hrSelected",htmlCode:"LexicalTheme__htmlCode",image:"LexicalTheme__image",indent:"LexicalTheme__indent",layoutContainer:"LexicalTheme__layoutContainer",layoutItem:"LexicalTheme__layoutItem",link:"LexicalTheme__link",list:{checklist:"LexicalTheme__checklist",listitem:"LexicalTheme__listItem",listitemChecked:"LexicalTheme__listItemChecked",listitemUnchecked:"LexicalTheme__listItemUnchecked",nested:{listitem:"LexicalTheme__nestedListItem"},ol:"LexicalTheme__ol",olDepth:["LexicalTheme__ol1","LexicalTheme__ol2","LexicalTheme__ol3","LexicalTheme__ol4","LexicalTheme__ol5"],ul:"LexicalTheme__ul"},ltr:"LexicalTheme__ltr",mark:"LexicalTheme__mark",markOverlap:"LexicalTheme__markOverlap",paragraph:"LexicalTheme__paragraph",quote:"LexicalTheme__quote",rtl:"LexicalTheme__rtl",specialText:"LexicalTheme__specialText",tab:"LexicalTheme__tabNode",table:"LexicalTheme__table",tableAddColumns:"LexicalTheme__tableAddColumns",tableAddRows:"LexicalTheme__tableAddRows",tableCell:"LexicalTheme__tableCell",tableCellActionButton:"LexicalTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalTheme__tableCellEditing",tableCellHeader:"LexicalTheme__tableCellHeader",tableCellPrimarySelected:"LexicalTheme__tableCellPrimarySelected",tableCellResizer:"LexicalTheme__tableCellResizer",tableCellSelected:"LexicalTheme__tableCellSelected",tableCellSortedIndicator:"LexicalTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalTheme__tableResizeRuler",tableSelected:"LexicalTheme__tableSelected",tableSelection:"LexicalTheme__tableSelection",text:{bold:"LexicalTheme__textBold",capitalize:"LexicalTheme__textCapitalize",code:"LexicalTheme__textCode",highlight:"LexicalTheme__textHighlight",italic:"LexicalTheme__textItalic",lowercase:"LexicalTheme__textLowercase",strikethrough:"LexicalTheme__textStrikethrough",subscript:"LexicalTheme__textSubscript",superscript:"LexicalTheme__textSuperscript",underline:"LexicalTheme__textUnderline",underlineStrikethrough:"LexicalTheme__textUnderlineStrikethrough",uppercase:"LexicalTheme__textUppercase"}};Se();var xl=class extends ho{constructor(n,o="block"){super();this.listeners=new Map;this.docId="custom-block";this.collectionId="custom-block";this.slug="custom-block";this.data={[o]:et(n)}}getValue(n){return Yo(this.data,n)}async updateKey(n,o){qM(this.data,n,o),this.notify(n)}async updateKeys(n){for(let[o,r]of Object.entries(n))qM(this.data,o,r),this.notify(o)}async removeKey(n){dW(this.data,n),this.notify(n)}subscribe(n,o){return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(o),o(this.getValue(n)),()=>{this.listeners.get(n)?.delete(o)}}subscribeSubtree(n,o){return this.subscribe(n,o)}getDataSnapshot(){return et(this.data)}getData(){return this.getDataSnapshot()}notify(n){this.dispatch("VALUE_CHANGE",n,this.getValue(n));for(let o of uW(n)){let r=this.listeners.get(o);if(!r)continue;let i=this.getValue(o);r.forEach(s=>s(i))}}};function qM(t,e,n){let o=e.split("."),r=t;for(let i=0;i<o.length-1;i++){let s=o[i];(typeof r[s]!="object"||r[s]===null||Array.isArray(r[s]))&&(r[s]={}),r=r[s]}r[o.at(-1)]=n}function dW(t,e){let n=e.split("."),o=t;for(let r=0;r<n.length-1;r++)if(o=o?.[n[r]],typeof o!="object"||o===null)return;o&&delete o[n.at(-1)]}function uW(t){let e=t.split("."),n=[];for(let o=e.length;o>0;o--)n.push(e.slice(0,o).join("."));return n}function JM(t){let e=X(()=>new xl(t.initialValue||{}),[t.schema,t.initialValue]),n=X(()=>({loading:!1,controller:e}),[e]),o=X(()=>({type:"object",id:"block",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),r=()=>{let s=e.getValue("block")||{},a=et(s);t.schema.name==="image"&&a?.file?.src&&(a.file.url=pW(a.file.src)),t.onSubmit(a)},i=ot();return f(Xi,{...i,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:f(po,{spacing:"md",children:[t.schema.fields.length>0?f(pu,{value:n,children:f(Ie.ObjectField,{field:o,deepKey:"block"})}):f(pn,{size:"sm",color:"dimmed",children:"This block does not define any editable fields."}),f(fn,{position:"right",spacing:"sm",children:[f(Z,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),f(Z,{size:"xs",onClick:r,children:t.mode==="edit"?"Save block":"Insert block"})]})]})})}function pW(t){return fW(t)?`${t}=s0-e365`:t}function fW(t){return t.startsWith("https://lh3.googleusercontent.com/")}var Wv={};$e(Wv,{$isDecoratorBlockNode:()=>hW,DecoratorBlockNode:()=>uh});var uh=class extends tl{constructor(e,n){super(n),this.__format=e||""}exportJSON(){return{...super.exportJSON(),format:this.__format||""}}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format||"")}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){let n=this.getWritable();return n.__format=e,n}isInline(){return!1}};function hW(t){return t instanceof uh}var XM=Wv,ZM=XM.$isDecoratorBlockNode,QM=XM.DecoratorBlockNode;Se();function gW(t){let{nodeKey:e}=t,[n]=ve(),[o,r,i]=Kf(e),{blocks:s,onEditBlock:a}=$M(),l=s.get(t.blockName),c=l?.label||l?.name||t.blockName,d=X(()=>{if(l)return GT(l,t.data)},[l,t.data]),u=X(()=>{if(l)return YT(l,t.data)},[l,t.data]);return F(()=>He(n.registerCommand(cr,p=>{let h=p.target;return!h||!h.closest(`[data-node-key="${e}"]`)?!1:(p.preventDefault(),p.stopPropagation(),o?r(!1):(i(),r(!0)),!0)},Re)),[n,o,e,i,r]),f("div",{className:xe("LexicalEditor__customBlock",o&&"LexicalEditor__customBlock--selected"),"data-node-key":e,children:[f("div",{className:"LexicalEditor__customBlock__header",children:[f("div",{className:"LexicalEditor__customBlock__header__title",children:c}),l&&a&&f("div",{className:"LexicalEditor__customBlock__actions",children:f(Z,{size:"xs",variant:"default",compact:!0,onClick:()=>a(t.blockName,{mode:"edit",nodeKey:t.nodeKey,initialValue:t.data}),children:"Edit block"})})]}),u&&yr(u)&&f("div",{className:"LexicalEditor__customBlock__previewImage",children:[f("img",{src:u,alt:""}),t.data.loading&&f("div",{className:"LexicalEditor__customBlock__previewImage__loading",children:f(Ft,{variant:"oval",color:"gray"})})]}),d&&f("div",{className:xe("LexicalEditor__customBlock__preview",l?.name==="html"&&"LexicalEditor__customBlock__preview--html"),children:d})]})}var vl=class t extends QM{static getType(){return"block-component"}static clone(e){return new t(e.__blockName,e.__blockData,e.__key)}static importJSON(e){let{blockName:n,data:o}=e;return new t(n,o)}exportJSON(){return{...super.exportJSON(),type:"block-component",blockName:this.__blockName,data:et(this.__blockData),version:1}}constructor(e,n,o){super("",o),this.__blockName=e,this.__blockData=n?et(n):{}}createDOM(){let e=document.createElement("div");return e.className="LexicalEditor__customBlockWrapper",e}updateDOM(){return!1}decorate(){return f(gW,{blockName:this.__blockName,data:this.__blockData,nodeKey:this.__key})}getBlockName(){return this.__blockName}getBlockData(){return this.__blockData}setBlockData(e){let n=this.getWritable();n.__blockData=et(e)}};function js(t,e){return new vl(t,e)}function Xr(t){return t instanceof vl}Se();function eL(t){let[e,n]=L(t.componentId);F(()=>{n(t.componentId)},[t.componentId]);let o=X(()=>new xl(t.initialValue||{},"component"),[t.schema,t.initialValue]),r=X(()=>({loading:!1,controller:o}),[o]),i=X(()=>({type:"object",id:"component",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),s=()=>{let l=o.getValue("component")||{},c=et(l);t.onSubmit({componentId:e.trim(),data:c})},a=ot();return f(Xi,{...a,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:f(po,{spacing:"md",children:[f(Jn,{label:"Component ID",value:e,onChange:l=>n(l.currentTarget.value),placeholder:"component-id",required:!0}),t.schema.fields.length>0?f(pu,{value:r,children:f(Ie.ObjectField,{field:i,deepKey:"component"})}):f(pn,{size:"sm",color:"dimmed",children:"This component does not define any editable fields."}),f(fn,{position:"right",spacing:"sm",children:[f(Z,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),f(Z,{size:"xs",onClick:s,disabled:!e.trim(),children:t.mode==="edit"?"Save component":"Insert component"})]})]})})}si();function mW(t){let{componentName:e,componentId:n,nodeKey:o}=t,{components:r,onEditComponent:i}=UM(),s=r.get(e),a=s?.label||s?.name||e,l=Ne(c=>{c.preventDefault(),c.stopPropagation(),i&&i(e,{componentId:n,initialValue:t.data,mode:"edit",nodeKey:o})},[e,n,o,i,t.data]);return f("span",{className:"LexicalEditor__inlineComponent","data-node-key":o,contentEditable:!1,children:f("button",{type:"button",className:xe("LexicalEditor__inlineComponent__button",!i&&"LexicalEditor__inlineComponent__button--disabled"),onClick:i?l:void 0,title:a?`${a} (${n})`:n,contentEditable:!1,children:[f("span",{className:"LexicalEditor__inlineComponent__label",children:a}),f("span",{className:"LexicalEditor__inlineComponent__id",children:n})]})})}var Cl=class t extends tl{static getType(){return"inline-component"}static clone(e){return new t(e.__componentName,e.__componentId,e.__componentData,e.__key)}static importJSON(e){let{componentName:n,componentId:o,data:r}=e;return new t(n,o,r)}exportJSON(){return{...super.exportJSON(),type:"inline-component",componentName:this.__componentName,componentId:this.__componentId,data:et(this.__componentData),version:1}}constructor(e,n,o,r){super(r),this.__componentName=e,this.__componentId=n,this.__componentData=o?et(o):{}}createDOM(){let e=document.createElement("span");return e.className="LexicalEditor__inlineComponentWrapper",e.contentEditable="false",e}updateDOM(){return!1}isInline(){return!0}isIsolated(){return!0}decorate(){return f(mW,{componentName:this.__componentName,componentId:this.__componentId,data:this.__componentData,nodeKey:this.__key})}getComponentName(){return this.__componentName}setComponentName(e){let n=this.getWritable();n.__componentName=e}getComponentId(){return this.__componentId}setComponentId(e){let n=this.getWritable();n.__componentId=e}getComponentData(){return this.__componentData}setComponentData(e){let n=this.getWritable();n.__componentData=et(e)}};function ph(t,e,n){return new Cl(t,e,n)}function El(t){return t instanceof Cl}var ji=class t extends Ut{static getType(){return"special-character"}static clone(e){return new t(e.__text,e.__key)}static importJSON(e){return Gv(e.text)}constructor(e,n){super(e,n)}exportJSON(){return{...super.exportJSON(),type:"special-character"}}createDOM(e){let n=super.createDOM(e);return Ye(n,"SpecialCharacterNode"),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o);return Ye(n,"SpecialCharacterNode"),r}isTextEntity(){return!0}canInsertTextAfter(){return!1}};function Gv(t){return new ji(t)}function tL(t){return t instanceof ji}si();Se();function Zr(t){let e=t.anchor,n=t.focus,o=t.anchor.getNode(),r=t.focus.getNode();return o===r?o:t.isBackward()?yx(n)?o:r:yx(e)?o:r}function nL(t,e){let n=t.getRangeAt(0),o;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!==null;)r=r.firstElementChild;o=r.getBoundingClientRect()}else o=n.getBoundingClientRect();return o}var _W=10,bW=5;function yW(t){let{editor:e,isLink:n,setIsLink:o,anchorElem:r,isLinkEditMode:i,setIsLinkEditMode:s,onDismiss:a}=t,l=J(null),c=J(null),[d,u]=L(""),[p,h]=L(""),[g,m]=L(null),[_,b]=L(null),[y,v]=L(null),x=J(""),C=Ne(()=>{let S=z();if(B(S)){let I=Zr(S),R=ue(I,Qe),$="",W=null;R?($=R.getURL(),W=R.getTarget()||null):Qe(I)&&($=I.getURL(),W=I.getTarget()||null),u($),m(W);let P=c.current===document.activeElement,q=$!==x.current;(!P||q)&&(h(Qr($)),b(W)),x.current=$}else if(gt(S)){let I=S.getNodes();if(I.length>0){let R=I[0],$=R.getParent(),W="",P=null;Qe($)?(W=$.getURL(),P=$.getTarget()||null):Qe(R)&&(W=R.getURL(),P=R.getTarget()||null),u(W),m(P);let q=c.current===document.activeElement,ce=W!==x.current;(!q||ce)&&(h(Qr(W)),b(P)),x.current=W}}let N=l.current,D=so(e._window),O=document.activeElement;if(N===null)return;let A=e.getRootElement();if(S!==null&&A!==null&&e.isEditable()){let I;if(gt(S)){let R=S.getNodes();if(R.length>0){let $=e.getElementByKey(R[0].getKey());$&&(I=$.getBoundingClientRect())}}else D!==null&&A.contains(D.anchorNode)&&(I=D.focusNode?.parentElement?.getBoundingClientRect());I&&(I.y+=40,oL(I,N,r)),v(S)}else(!O||O.className!=="link-input")&&(A!==null&&oL(null,N,r),v(null),s(!1),u(""),x.current="");return!0},[r,e,s,i,d]);F(()=>{let S=r.parentElement,N=()=>{e.getEditorState().read(()=>{C()})};return window.addEventListener("resize",N),S&&S.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),S&&S.removeEventListener("scroll",N)}},[r.parentElement,e,C]),F(()=>He(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{C()})}),e.registerCommand(gn,()=>(C(),!0),Re),e.registerCommand(Li,()=>n?(o(!1),a?.(),!0):!1,Ai)),[e,C,o,n]),F(()=>{e.getEditorState().read(()=>{C()})},[e,C]),F(()=>{n&&e.getEditorState().read(()=>{C()})},[n,e,C]),F(()=>{i&&c.current&&c.current.focus()},[i,n]),F(()=>{if(!n)return;let S=()=>{o(!1),s(!1),a?.()},N=O=>{let A=O.target;A&&(l.current&&l.current.contains(A)||r.contains(A)||r.parentElement&&r.parentElement.contains(A)||S())},D=O=>{O.key==="Escape"&&l.current&&l.current.contains(document.activeElement)&&(O.preventDefault(),S())};return window.addEventListener("mousedown",N),window.addEventListener("keydown",D),()=>{window.removeEventListener("mousedown",N),window.removeEventListener("keydown",D)}},[n,r,o,s]);let E=S=>{S.key==="Enter"?(S.preventDefault(),k()):S.key==="Escape"&&(S.preventDefault(),o(!1),s(!1),a?.())},k=S=>{if(S&&S.preventDefault(),y!==null){if(d!==null){let N=_==="_blank"?"_blank":null;e.update(()=>{let D=z();if(B(D)){let O=Zr(D),A=ue(O,Qe);A?(A.setURL(Qr(p)),A.setTarget(N)):Qe(O)?(O.setURL(Qr(p)),O.setTarget(N)):e.dispatchCommand(Gn,{url:Qr(p),target:N})}else if(gt(D)){let O=D.getNodes();if(O.length>0){let A=O[0],I=A.getParent();Qe(I)?(I.setURL(Qr(p)),I.setTarget(N)):Qe(A)&&(A.setURL(Qr(p)),A.setTarget(N))}}})}s(!1)}},T=Qr(p)!==Qr(d)||_!==g,w=()=>{h(d),b(g)};return f("div",{ref:l,className:xe("LexicalEditor__linkEditor",!n&&"LexicalEditor__linkEditor--hidden"),children:!n||!y?null:f("div",{className:"LexicalEditor__link__editForm",children:[f(bn,{ref:c,className:"LexicalEditor__link__input",value:p,onChange:S=>{let N=S.target;h(N.value)},onKeyDown:S=>{E(S)},autosize:!0,minRows:1,radius:"xs",placeholder:"https://"}),f("div",{className:"LexicalEditor__link__row",children:[f(uo,{className:"LexicalEditor__link__target",label:"Open in new tab",checked:_==="_blank",onChange:S=>b(S.currentTarget.checked?"_blank":null),size:"xs"}),f("div",{className:"LexicalEditor__link__controls",children:[f(Yv,{tooltip:"Remove",onClick:()=>{e.dispatchCommand(Gn,null)},children:f(Xn,{size:12})}),f(Yv,{tooltip:"Undo",onClick:w,disabled:!T,children:f(li,{size:12})}),f(Yv,{tooltip:"Save",onClick:()=>k(),disabled:!T,color:"green",children:f(Qi,{size:12})})]})]})]})})}function Yv(t){return f(De,{label:t.tooltip,position:"top",withArrow:!0,children:f(Ae,{radius:"xl",variant:t.color?"filled":"default",color:t.color||"dark",size:"sm",title:t.tooltip,onClick:t.onClick,disabled:t.disabled,children:t.children})})}function xW(t,e,n,o){let[r,i]=L(t),[s,a]=L(!1),l=J(0),c=300,d=Ne(()=>{l.current=Date.now()},[]);return F(()=>{function u(){if(Date.now()-l.current<c)return;let p=z();if(B(p)){let h=Zr(p),g=ue(h,Qe),m=ue(h,sd);if(!(g||m)){a(!1);return}let _=p.getNodes().filter(b=>!Ze(b)).find(b=>{let y=ue(b,Qe),v=ue(b,sd);return g&&!g.is(y)||y&&!y.is(g)||m&&!m.is(v)||v&&(!v.is(m)||v.getIsUnlinked())});a(!_)}else if(gt(p)){let h=p.getNodes();if(h.length===0){a(!1);return}let g=h[0],m=g.getParent();Qe(m)||Qe(g)?a(!0):a(!1)}}return He(t.registerUpdateListener(({editorState:p})=>{p.read(()=>{u()})}),t.registerCommand(gn,(p,h)=>(u(),i(h),!1),Nt),t.registerCommand(cr,p=>{let h=z();if(B(h)){let g=Zr(h),m=ue(g,Qe);if(m)return p.metaKey||p.ctrlKey?(window.open(m.getURL(),"_blank"),!0):(p.preventDefault(),p.stopPropagation(),!0)}return!1},Re))},[t]),ii(f(yW,{editor:r,isLink:s,anchorElem:e,setIsLink:a,isLinkEditMode:n,setIsLinkEditMode:o,onDismiss:d}),e)}function rL(t){let{anchorElem:e=document.body,isLinkEditMode:n,setIsLinkEditMode:o}=t,[r]=ve();return xW(r,e,n,o)}function oL(t,e,n,o=_W,r=bW){let i=n.parentElement;if(t===null||!i){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=e.getBoundingClientRect(),a=n.getBoundingClientRect(),l=i.getBoundingClientRect(),c=t.top-o,d=t.left-r;c<l.top&&(c+=s.height+t.height+o*2),d+s.width>l.right&&(d=l.right-s.width-r),c-=a.top,d-=a.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}function Qr(t){return t&&t.trim()}var rce=kh(qv(),1);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:Prism.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(d){return d=d.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+d+")")}var o=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return o}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+i+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+i+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(o),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(o),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(d){["url","bold","italic","strike","code-snippet"].forEach(function(u){d!==u&&(t.languages.markdown[d].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(d){if(d.language!=="markdown"&&d.language!=="md")return;function u(p){if(!(!p||typeof p=="string"))for(var h=0,g=p.length;h<g;h++){var m=p[h];if(m.type!=="code"){u(m.content);continue}var _=m.content[1],b=m.content[3];if(_&&b&&_.type==="code-language"&&b.type==="code-block"&&typeof _.content=="string"){var y=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");y=(/[a-z][\w-]*/i.exec(y)||[""])[0].toLowerCase();var v="language-"+y;b.alias?typeof b.alias=="string"?b.alias=[b.alias,v]:b.alias.push(v):b.alias=[v]}}}u(d.tokens)}),t.hooks.add("wrap",function(d){if(d.type==="code-block"){for(var u="",p=0,h=d.classes.length;p<h;p++){var g=d.classes[p],m=/language-(.+)/.exec(g);if(m){u=m[1];break}}var _=t.languages[u];if(_)d.content=t.highlight(c(d.content),_,u);else if(u&&u!=="none"&&t.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);d.attributes.id=b,t.plugins.autoloader.loadLanguages(u,function(){var y=document.getElementById(b);y&&(y.innerHTML=t.highlight(y.textContent,t.languages[u],u))})}}});var s=RegExp(t.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function c(d){var u=d.replace(s,"");return u=u.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,h){if(h=h.toLowerCase(),h[0]==="#"){var g;return h[1]==="x"?g=parseInt(h.slice(2),16):g=Number(h.slice(1)),l(g)}else{var m=a[h];return m||p}}),u}t.languages.md=t.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var e=t.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(t){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism);Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=Prism.languages.swift});(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,o={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[o,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:o.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:o.inside}],keyword:e,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":o,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:o.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:o.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);(function(t){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(Prism);(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
120
+ ?|
121
+ |(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var xce=globalThis.Prism||window.Prism;var rC={};$e(rC,{$createCodeHighlightNode:()=>mh,$createCodeNode:()=>wl,$getEndOfCodeInLine:()=>oC,$getFirstCodeNodeOfLine:()=>Wi,$getLastCodeNodeOfLine:()=>Ws,$getStartOfCodeInLine:()=>nC,$isCodeHighlightNode:()=>Rt,$isCodeNode:()=>jo,CODE_LANGUAGE_FRIENDLY_NAME_MAP:()=>gL,CODE_LANGUAGE_MAP:()=>mL,CodeHighlightNode:()=>Gs,CodeNode:()=>Vi,DEFAULT_CODE_LANGUAGE:()=>tC,PrismTokenizer:()=>yL,getCodeLanguages:()=>SW,getDefaultCodeLanguage:()=>TW,getEndOfCodeInLine:()=>IW,getFirstCodeNodeOfLine:()=>DW,getLanguageFriendlyName:()=>wW,getLastCodeNodeOfLine:()=>OW,getStartOfCodeInLine:()=>AW,normalizeCodeLang:()=>_L,registerCodeHighlighting:()=>NW});var wce=kh(qv(),1);function gh(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach((function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
122
+ ?|
123
+ |(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var To=globalThis.Prism||window.Prism;function Qv(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Qv).join(""):Qv(t.content)}var iL=t=>{let e=/^diff-([\w-]+)/i;try{if(!t)return!1;let n=e.exec(t);return n?To.languages.hasOwnProperty("diff")&&To.languages.hasOwnProperty(n[1]):To.languages.hasOwnProperty(t)}catch{return!1}};function hL(t,e){for(let n of t.childNodes){if(en(n)&&n.tagName===e)return!0;hL(n,e)}return!1}var yd="data-language",hh="data-highlight-language",Vi=class t extends Ht{static getType(){return"code"}static clone(e){return new t(e.__language,e.__key)}constructor(e,n){super(n),this.__language=e||void 0,this.__isSyntaxHighlightSupported=iL(e)}createDOM(e){let n=document.createElement("code");Ye(n,e.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(yd,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(hh,o)),n}updateDOM(e,n,o){let r=this.__language,i=e.__language;return r?r!==i&&(n.setAttribute(yd,r),this.__isSyntaxHighlightSupported&&n.setAttribute(hh,r)):i&&(n.removeAttribute(yd),e.__isSyntaxHighlightSupported&&n.removeAttribute(hh)),!1}exportDOM(e){let n=document.createElement("pre");Ye(n,e._config.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(yd,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(hh,o)),{element:n}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||hL(e,"BR"))?{conversion:sL,priority:1}:null,div:()=>({conversion:CW,priority:1}),pre:()=>({conversion:sL,priority:0}),table:e=>Jv(e)?{conversion:EW,priority:3}:null,td:e=>{let n=e,o=n.closest("table");return n.classList.contains("js-file-line")||o&&Jv(o)?{conversion:aL,priority:3}:null},tr:e=>{let n=e.closest("table");return n&&Jv(n)?{conversion:aL,priority:3}:null}}}static importJSON(e){return wl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(e,n=!0){let o=this.getChildren(),r=o.length;if(r>=2&&o[r-1].getTextContent()===`
124
+ `&&o[r-2].getTextContent()===`
125
+ `&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){o[r-1].remove(),o[r-2].remove();let l=ge();return this.insertAfter(l,n),l}let{anchor:i,focus:s}=e,a=(i.isBefore(s)?i:s).getNode();if(te(a)){let l=Wi(a),c=[];for(;;)if(Un(l))c.push(Bo()),l=l.getNextSibling();else{if(!Rt(l))break;{let _=0,b=l.getTextContent(),y=l.getTextContentSize();for(;_<y&&b[_]===" ";)_++;if(_!==0&&c.push(mh(" ".repeat(_))),_!==y)break;l=l.getNextSibling()}}let d=a.splitText(i.offset)[0],u=i.offset===0?0:1,p=d.getIndexWithinParent()+u,h=a.getParentOrThrow(),g=[Fo(),...c];h.splice(p,0,g);let m=c[c.length-1];m?m.select():i.offset===0?d.selectPrevious():d.getNextSibling().selectNext(0,0)}if(jo(a)){let{offset:l}=e.anchor;a.splice(l,0,[Fo()]),a.select(l+1,l+1)}return null}canIndent(){return!1}collapseAtStart(){let e=ge();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}setLanguage(e){let n=this.getWritable();return n.__language=e||void 0,n.__isSyntaxHighlightSupported=iL(e),n}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function wl(t){return At(new Vi(t))}function jo(t){return t instanceof Vi}function sL(t){return{node:wl(t.getAttribute(yd))}}function CW(t){let e=t,n=lL(e);return n||(function(o){let r=o.parentElement;for(;r!==null;){if(lL(r))return!0;r=r.parentElement}return!1})(e)?{node:n?wl():null}:{node:null}}function EW(){return{node:wl()}}function aL(){return{node:null}}function lL(t){return t.style.fontFamily.match("monospace")!==null}function Jv(t){return t.classList.contains("js-file-line-container")}var tC="javascript",gL={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},mL={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function _L(t){return mL[t]||t}function wW(t){let e=_L(t);return gL[e]||e}var TW=()=>tC,SW=()=>Object.keys(To.languages).filter((t=>typeof To.languages[t]!="function")).sort(),Gs=class t extends Ut{constructor(e="",n,o){super(e,o),this.__highlightType=n}static getType(){return"code-highlight"}static clone(e){return new t(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let n=this.getWritable();return n.__highlightType=e||void 0,n}canHaveFormat(){return!1}createDOM(e){let n=super.createDOM(e),o=Xv(e.theme,this.__highlightType);return Ye(n,o),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o),i=Xv(o.theme,e.__highlightType),s=Xv(o.theme,this.__highlightType);return i!==s&&(i&&Wn(n,i),s&&Ye(n,s)),r}static importJSON(e){return mh().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return wl()}};function Xv(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function mh(t="",e){return At(new Gs(t,e))}function Rt(t){return t instanceof Gs}function bL(t,e){let n=t;for(let o=Nn(t,e);o&&(Rt(o.origin)||Un(o.origin));o=hI(o))n=o.origin;return n}function Wi(t){return bL(t,"previous")}function Ws(t){return bL(t,"next")}var yL={defaultLanguage:tC,tokenize(t,e){return To.tokenize(t,To.languages[e||""]||To.languages[this.defaultLanguage])}};function nC(t,e){let n=null,o=null,r=t,i=e,s=t.getTextContent();for(;;){if(i===0){if(r=r.getPreviousSibling(),r===null)break;if(Rt(r)||Un(r)||Ze(r)||gh(167),Ze(r)){n={node:r,offset:1};break}i=Math.max(0,r.getTextContentSize()-1),s=r.getTextContent()}else i--;let l=s[i];Rt(r)&&l!==" "&&(o={node:r,offset:i})}if(o!==null)return o;let a=null;if(e<t.getTextContentSize())Rt(t)&&(a=t.getTextContent()[e]);else{let l=t.getNextSibling();Rt(l)&&(a=l.getTextContent()[0])}if(a!==null&&a!==" ")return n;{let l=(function(c,d){let u=c,p=d,h=c.getTextContent(),g=c.getTextContentSize();for(;;){if(!Rt(u)||p===g){if(u=u.getNextSibling(),u===null||Ze(u))return null;Rt(u)&&(p=0,h=u.getTextContent(),g=u.getTextContentSize())}if(Rt(u)){if(h[p]!==" ")return{node:u,offset:p};p++}}})(t,e);return l!==null?l:n}}function oC(t){let e=Ws(t);return Ze(e)&&gh(168),e}function cL(t,e,n){let o=t.getParent();jo(o)?xL(o,e,n):Rt(t)&&t.replace(kt(t.__text))}function kW(t,e){let n=e.getElementByKey(t.getKey());if(n===null)return;let o=t.getChildren(),r=o.length;if(r===n.__cachedChildrenLength)return;n.__cachedChildrenLength=r;let i="1",s=1;for(let a=0;a<r;a++)Ze(o[a])&&(i+=`
126
+ `+ ++s);n.setAttribute("data-gutter",i)}var Zv=new Set;function xL(t,e,n){let o=t.getKey();Zv.has(o)||(Zv.add(o),t.getLanguage()===void 0&&t.setLanguage(n.defaultLanguage),e.update((()=>{(function(r,i){let s=Mt(r);if(!jo(s)||!s.isAttached())return;let a=z();if(!B(a))return void i();let l=a.anchor,c=l.offset,d=l.type==="element"&&Ze(s.getChildAtIndex(l.offset-1)),u=0;if(!d){let p=l.getNode();u=c+p.getPreviousSiblings().reduce(((h,g)=>h+g.getTextContentSize()),0)}if(i()){if(d)return void l.getNode().select(c,c);s.getChildren().some((p=>{let h=te(p);if(h||Ze(p)){let g=p.getTextContentSize();if(h&&g>=u)return p.select(u,u),!0;u-=g}return!1}))}})(o,(()=>{let r=Mt(o);if(!jo(r)||!r.isAttached())return!1;let i=r.getLanguage()||n.defaultLanguage,s=/^diff-([\w-]+)/i.exec(i),a=r.getTextContent(),l=n.tokenize(a,s?"diff":i);s&&(l=(function(g,m){let _=m,b=To.languages[_],y={tokens:g},v=To.languages.diff.PREFIXES;for(let x of y.tokens){if(typeof x=="string"||!(x.type in v)||!Array.isArray(x.content))continue;let C=x.type,E=0,k=()=>(E++,new To.Token("prefix",v[C],C.replace(/^(\w+).*/,"$1"))),T=x.content.filter((A=>typeof A=="string"||A.type!=="prefix")),w=x.content.length-T.length,S=To.tokenize(Qv(T),b);S.unshift(k());let N=/\r\n|\n/g,D=A=>{let I=[];N.lastIndex=0;let R,$=0;for(;E<w&&(R=N.exec(A));){let W=R.index+R[0].length;I.push(A.slice($,W)),$=W,I.push(k())}if(I.length!==0)return $<A.length&&I.push(A.slice($)),I},O=A=>{for(let I=0;I<A.length&&E<w;I++){let R=A[I];if(typeof R=="string"){let $=D(R);$&&(A.splice(I,1,...$),I+=$.length-1)}else if(typeof R.content=="string"){let $=D(R.content);$&&(R.content=$)}else Array.isArray(R.content)?O(R.content):O([R.content])}};O(S),E<w&&S.push(k()),x.content=S}return y.tokens})(l,s[1]));let c=eC(l),d=(function(g,m){let _=0;for(;_<g.length&&dL(g[_],m[_]);)_++;let b=g.length,y=m.length,v=Math.min(b,y)-_,x=0;for(;x<v;)if(x++,!dL(g[b-x],m[y-x])){x--;break}let C=_,E=b-x,k=m.slice(_,y-x);return{from:C,nodesForReplacement:k,to:E}})(r.getChildren(),c),{from:u,to:p,nodesForReplacement:h}=d;return!(u===p&&!h.length)&&(t.splice(u,p-u,h),!0)}))}),{onUpdate:()=>{Zv.delete(o)},skipTransforms:!0}))}function eC(t,e){let n=[];for(let o of t)if(typeof o=="string"){let r=o.split(/(\n|\t)/),i=r.length;for(let s=0;s<i;s++){let a=r[s];a===`
127
+ `||a===`\r
128
+ `?n.push(Fo()):a===" "?n.push(Bo()):a.length>0&&n.push(mh(a,e))}}else{let{content:r,alias:i}=o;typeof r=="string"?n.push(...eC([r],o.type==="prefix"&&typeof i=="string"?i:o.type)):Array.isArray(r)&&n.push(...eC(r,o.type==="unchanged"?void 0:o.type))}return n}function dL(t,e){return Rt(t)&&Rt(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||Un(t)&&Un(e)||Ze(t)&&Ze(e)}function Vs(t){if(!B(t))return!1;let e=t.anchor.getNode(),n=jo(e)?e:e.getParent(),o=t.focus.getNode(),r=jo(o)?o:o.getParent();return jo(n)&&n.is(r)}function vL(t){let e=t.getNodes(),n=[];if(e.length===1&&jo(e[0]))return n;let o=[];for(let r=0;r<e.length;r++){let i=e[r];Rt(i)||Un(i)||Ze(i)||gh(169),Ze(i)?o.length>0&&(n.push(o),o=[]):o.push(i)}if(o.length>0){let r=t.isBackward()?t.anchor:t.focus,i=ir(o[0].getKey(),0,"text");r.is(i)||n.push(o)}return n}function uL(t){let e=z();if(!B(e)||!Vs(e))return!1;let n=vL(e),o=n.length;if(o===0&&e.isCollapsed())return t===Kn&&e.insertNodes([Bo()]),!0;if(o===0&&t===Kn&&e.getTextContent()===`
129
+ `){let r=Bo(),i=Fo(),s=e.isBackward()?"previous":"next";return e.insertNodes([r,i]),gf(JD(df(eO(r,"next",0),lr(Nn(i,"next"))),s)),!0}for(let r=0;r<o;r++){let i=n[r];if(i.length>0){let s=i[0];if(r===0&&(s=Wi(s)),t===Kn){let a=Bo();if(s.insertBefore(a),r===0){let l=e.isBackward()?"focus":"anchor",c=ir(s.getKey(),0,"text");e[l].is(c)&&e[l].set(a.getKey(),0,"text")}}else Un(s)&&s.remove()}}return!0}function pL(t,e){let n=z();if(!B(n))return!1;let{anchor:o,focus:r}=n,i=o.offset,s=r.offset,a=o.getNode(),l=r.getNode(),c=t===zo;if(!Vs(n)||!Rt(a)&&!Un(a)||!Rt(l)&&!Un(l))return!1;if(!e.altKey){if(n.isCollapsed()){let b=a.getParentOrThrow();if(c&&i===0&&a.getPreviousSibling()===null){if(b.getPreviousSibling()===null)return b.selectPrevious(),e.preventDefault(),!0}else if(!c&&i===a.getTextContentSize()&&a.getNextSibling()===null&&b.getNextSibling()===null)return b.selectNext(),e.preventDefault(),!0}return!1}let d,u;if(a.isBefore(l)?(d=Wi(a),u=Ws(l)):(d=Wi(l),u=Ws(a)),d==null||u==null)return!1;let p=d.getNodesBetween(u);for(let b=0;b<p.length;b++){let y=p[b];if(!Rt(y)&&!Un(y)&&!Ze(y))return!1}e.preventDefault(),e.stopPropagation();let h=c?d.getPreviousSibling():u.getNextSibling();if(!Ze(h))return!0;let g=c?h.getPreviousSibling():h.getNextSibling();if(g==null)return!0;let m=Rt(g)||Un(g)||Ze(g)?c?Wi(g):Ws(g):null,_=m??g;return h.remove(),p.forEach((b=>b.remove())),t===zo?(p.forEach((b=>_.insertBefore(b))),_.insertBefore(h)):(_.insertAfter(h),_=h,p.forEach((b=>{_.insertAfter(b),_=b}))),n.setTextNodeRange(a,i,l,s),!0}function fL(t,e){let n=z();if(!B(n))return!1;let{anchor:o,focus:r}=n,i=o.getNode(),s=r.getNode(),a=t===Sf;if(!Vs(n)||!Rt(i)&&!Un(i)||!Rt(s)&&!Un(s))return!1;if(a){let l=nC(s,r.offset);if(l!==null){let{node:c,offset:d}=l;Ze(c)?c.selectNext(0,0):n.setTextNodeRange(c,d,c,d)}else s.getParentOrThrow().selectStart()}else oC(s).select();return e.preventDefault(),e.stopPropagation(),!0}function NW(t,e){if(!t.hasNodes([Vi,Gs]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");e==null&&(e=yL);let n=[];return t._headless!==!0&&n.push(t.registerMutationListener(Vi,(o=>{t.update((()=>{for(let[r,i]of o)if(i!=="destroyed"){let s=Mt(r);s!==null&&kW(s,t)}}))}),{skipInitialization:!1})),n.push(t.registerNodeTransform(Vi,(o=>xL(o,t,e))),t.registerNodeTransform(Ut,(o=>cL(o,t,e))),t.registerNodeTransform(Gs,(o=>cL(o,t,e))),t.registerCommand(Ri,(o=>{let r=(function(i){let s=z();if(!B(s)||!Vs(s))return null;let a=i?Eo:Kn,l=i?Eo:Ms,c=s.anchor,d=s.focus;if(c.is(d))return l;let u=vL(s);if(u.length!==1)return a;let p=u[0],h,g;p.length===0&&gh(285),s.isBackward()?(h=d,g=c):(h=c,g=d);let m=Wi(p[0]),_=Ws(p[0]),b=ir(m.getKey(),0,"text"),y=ir(_.getKey(),_.getTextContentSize(),"text");return h.isBefore(b)||y.isBefore(g)?a:b.isBefore(h)||g.isBefore(y)?l:a})(o.shiftKey);return r!==null&&(o.preventDefault(),t.dispatchCommand(r,void 0),!0)}),Re),t.registerCommand(Ms,(()=>!!Vs(z())&&($o([Bo()]),!0)),Re),t.registerCommand(Kn,(o=>uL(Kn)),Re),t.registerCommand(Eo,(o=>uL(Eo)),Re),t.registerCommand(zo,(o=>{let r=z();if(!B(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Vs(r)&&(r.isCollapsed()&&i.offset===0&&s.getPreviousSibling()===null&&jo(s.getParentOrThrow())?(o.preventDefault(),!0):pL(zo,o))}),Re),t.registerCommand(Vr,(o=>{let r=z();if(!B(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Vs(r)&&(r.isCollapsed()&&i.offset===s.getTextContentSize()&&s.getNextSibling()===null&&jo(s.getParentOrThrow())?(o.preventDefault(),!0):pL(Vr,o))}),Re),t.registerCommand(Sf,(o=>fL(Sf,o)),Re),t.registerCommand(cx,(o=>fL(cx,o)),Re)),He(...n)}var DW=Wi,OW=Ws,IW=oC,AW=nC;var mt=rC,Hce=mt.$createCodeHighlightNode,xd=mt.$createCodeNode,Uce=mt.$getEndOfCodeInLine,Kce=mt.$getFirstCodeNodeOfLine,jce=mt.$getLastCodeNodeOfLine,Vce=mt.$getStartOfCodeInLine,CL=mt.$isCodeHighlightNode,iC=mt.$isCodeNode,Wce=mt.CODE_LANGUAGE_FRIENDLY_NAME_MAP,Gce=mt.CODE_LANGUAGE_MAP,Yce=mt.CodeHighlightNode,EL=mt.CodeNode,qce=mt.DEFAULT_CODE_LANGUAGE,Jce=mt.PrismTokenizer,Xce=mt.getCodeLanguages,Zce=mt.getDefaultCodeLanguage,Qce=mt.getEndOfCodeInLine,ede=mt.getFirstCodeNodeOfLine,tde=mt.getLanguageFriendlyName,nde=mt.getLastCodeNodeOfLine,ode=mt.getStartOfCodeInLine,rde=mt.normalizeCodeLang,ide=mt.registerCodeHighlighting;si();Se();var tn=Object.freeze({NORMAL:Dt?"\u2318+Opt+0":"Ctrl+Alt+0",HEADING1:Dt?"\u2318+Opt+1":"Ctrl+Alt+1",HEADING2:Dt?"\u2318+Opt+2":"Ctrl+Alt+2",HEADING3:Dt?"\u2318+Opt+3":"Ctrl+Alt+3",NUMBERED_LIST:Dt?"\u2318+Shift+7":"Ctrl+Shift+7",BULLET_LIST:Dt?"\u2318+Shift+8":"Ctrl+Shift+8",STRIKETHROUGH:Dt?"\u2318+Shift+X":"Ctrl+Shift+X",SUBSCRIPT:Dt?"\u2318+,":"Ctrl+,",SUPERSCRIPT:Dt?"\u2318+.":"Ctrl+.",INDENT:Dt?"\u2318+]":"Ctrl+]",OUTDENT:Dt?"\u2318+[":"Ctrl+[",CLEAR_FORMATTING:Dt?"\u2318+\\":"Ctrl+\\",REDO:Dt?"\u2318+Shift+Z":"Ctrl+Y",UNDO:Dt?"\u2318+Z":"Ctrl+Z",BOLD:Dt?"\u2318+B":"Ctrl+B",ITALIC:Dt?"\u2318+I":"Ctrl+I",UNDERLINE:Dt?"\u2318+U":"Ctrl+U",INSERT_LINK:Dt?"\u2318+K":"Ctrl+K"}),Vo={ctrlKey:!Dt,metaKey:Dt};function wL(t){let{code:e}=t;return(e==="Numpad0"||e==="Digit0")&&Vn(t,{...Vo,altKey:!0})}function TL(t){let{code:e}=t,n=e[e.length-1];return["1","2","3","4","5"].includes(n)&&Vn(t,{...Vo,altKey:!0})}function SL(t){let{code:e}=t;return(e==="Numpad7"||e==="Digit7")&&Vn(t,{...Vo,shiftKey:!0})}function kL(t){let{code:e}=t;return(e==="Numpad8"||e==="Digit8")&&Vn(t,{...Vo,shiftKey:!0})}function NL(t){let{code:e}=t;return e==="KeyX"&&Vn(t,{...Vo,shiftKey:!0})}function DL(t){let{code:e}=t;return e==="BracketRight"&&Vn(t,Vo)}function OL(t){let{code:e}=t;return e==="BracketLeft"&&Vn(t,Vo)}function IL(t){let{code:e}=t;return e==="Comma"&&Vn(t,Vo)}function AL(t){let{code:e}=t;return e==="Period"&&Vn(t,Vo)}function ML(t){let{code:e}=t;return e==="Backslash"&&Vn(t,Vo)}function LL(t){let{code:e}=t;return e==="KeyK"&&Vn(t,Vo)}var Ys=t=>{t.update(()=>{let e=z();Df(e,()=>ge())})},Gi=(t,e,n)=>{e!==n&&t.update(()=>{let o=z();Df(o,()=>$s(n))})},_h=(t,e)=>{e!=="bullet"?t.dispatchCommand(zI,void 0):Ys(t)},bh=(t,e)=>{console.log("formatNumberedList"),e!=="number"?t.dispatchCommand($I,void 0):Ys(t)},Tl=t=>{t.update(()=>{let e=z();if(B(e)){let n=e.anchor,o=e.focus,r=e.getNodes(),i=e.extract();if(n.key===o.key&&n.offset===o.offset)return;r.forEach((s,a)=>{if(te(s)){let l=s;a===0&&n.offset!==0&&(l=l.splitText(n.offset)[1]||l),a===r.length-1&&(l=l.splitText(o.offset)[0]||l);let c=i[0];r.length===1&&te(c)&&(l=c),l.__style!==""&&l.setStyle(""),l.__format!==0&&l.setFormat(0);let d=Rs(l);d.__format!==0&&d.setFormat(""),d.__indent!==0&&d.setIndent(0)}else Gr(s)||Yr(s)?s.replace(ge(),!0):ZM(s)&&s.setFormat("")})}})},RL=(t,e)=>{e!=="quote"?t.update(()=>{let n=z();Df(n,()=>zs())}):Ys(t)};si();var MW=new Set(["http:","https:","mailto:","sms:","tel:"]);function PL(t){try{let e=new URL(t);if(!MW.has(e.protocol))return"about:blank"}catch{return t}return t}var yde=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function co(t){return t?"active dropdown-item-active":""}function mr(t){let{blockType:e}=t;return e==="paragraph"?f(cE,{size:16}):e==="h1"?f(EE,{size:16}):e==="h2"?f(wE,{size:16}):e==="h3"?f(TE,{size:16}):e==="h4"?f(SE,{size:16}):e==="h5"?f(kE,{size:16}):e==="number"?f(LE,{size:16}):e==="bullet"?f(RE,{size:16}):e==="quote"?f(KE,{size:16}):null}function LW(t){let{editor:e,blockType:n}=t;return f(G,{control:f(Z,{className:xe("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__blockFormatDropdown"),variant:"default",compact:!0,leftIcon:f(mr,{blockType:n}),rightIcon:f(fo,{size:16}),children:ch[n]}),children:[f(G.Item,{icon:f(mr,{blockType:"paragraph"}),className:co(n==="paragraph"),onClick:()=>Ys(e),children:"Normal"}),f(G.Item,{icon:f(mr,{blockType:"bullet"}),className:co(n==="bullet"),onClick:()=>_h(e,n),children:"Bullet List"}),f(G.Item,{icon:f(mr,{blockType:"number"}),className:co(n==="number"),onClick:()=>bh(e,n),children:"Numbered List"}),f(G.Item,{icon:f(mr,{blockType:"h1"}),className:co(n==="h1"),onClick:()=>Gi(e,n,"h1"),children:"Heading 1"}),f(G.Item,{icon:f(mr,{blockType:"h2"}),className:co(n==="h2"),onClick:()=>Gi(e,n,"h2"),children:"Heading 2"}),f(G.Item,{icon:f(mr,{blockType:"h3"}),className:co(n==="h3"),onClick:()=>Gi(e,n,"h3"),children:"Heading 3"}),f(G.Item,{icon:f(mr,{blockType:"h4"}),className:co(n==="h4"),onClick:()=>Gi(e,n,"h4"),children:"Heading 4"}),f(G.Item,{icon:f(mr,{blockType:"h5"}),className:co(n==="h5"),onClick:()=>Gi(e,n,"h5"),children:"Heading 5"}),f(G.Item,{icon:f(mr,{blockType:"quote"}),className:co(n==="quote"),onClick:()=>RL(e,n),children:"Quote"})]})}function vd(){return f("div",{className:"divider"})}function RW(t){let{editor:e,isStrikethrough:n,isSuperscript:o,isSubscript:r,isCode:i}=t;return f(G,{styles:{body:{minWidth:"240px"}},control:f(De,{className:xe("LexicalEditor__toolbar__actionIcon",(n||o||r||i)&&"LexicalEditor__toolbar__actionIcon--active"),label:"More formatting",position:"top",withArrow:!0,children:f(Ae,{variant:"default",title:"More formatting",children:f(fo,{size:16})})}),children:[f(G.Item,{icon:f(eu,{size:16}),className:co(n),onClick:()=>{e.dispatchCommand(at,"strikethrough")},children:["Strikethrough (",tn.STRIKETHROUGH,")"]}),f(G.Item,{icon:f(nu,{size:16}),className:co(o),onClick:()=>{e.dispatchCommand(at,"superscript")},children:["Superscript (",tn.SUPERSCRIPT,")"]}),f(G.Item,{icon:f(tu,{size:16}),className:co(r),onClick:()=>{e.dispatchCommand(at,"subscript")},children:["Subscript (",tn.SUBSCRIPT,")"]}),f(G.Item,{icon:f(Vd,{size:16}),className:co(i),onClick:()=>{e.dispatchCommand(at,"code")},children:"Code"})]})}function FL(t){let{editor:e,blockComponents:n,inlineComponents:o,activeEditor:r,setActiveEditor:i,setIsLinkEditMode:s,variant:a="document",onInsertBlockComponent:l,onInsertInlineComponent:c}=t,[d,u]=L(()=>e.isEditable()),{toolbarState:p,updateToolbarState:h}=dh(),g=Ne(()=>{let x=z();if(B(x)){if(r!==e&&mI(r)){let O=r.getRootElement();h("isImageCaption",!!O?.parentElement?.classList.contains("image-caption-container"))}else h("isImageCaption",!1);let C=x.anchor.getNode(),E=C.getKey()==="root"?C:ue(C,O=>{let A=O.getParent();return A!==null&&zt(A)});E===null&&(E=C.getTopLevelElementOrThrow());let k=E.getKey(),T=r.getElementByKey(k);h("isRTL",YO(x));let w=Zr(x),S=w.getParent(),N=Qe(S)||Qe(w);if(h("isLink",N),h("rootType","root"),T!==null)if(Dn(E)){let O=Mf(C,fr),A=O?O.getListType():E.getListType();h("blockType",A)}else{let O=Gr(E)?E.getTag():E.getType();O in ch&&h("blockType",O)}let D;Qe(S)&&(D=ue(w,O=>Y(O)&&!O.isInline())),h("elementFormat",Y(D)?D.getFormatType():Y(w)?w.getFormatType():S?.getFormatType()||"left")}B(x)&&(h("isBold",x.hasFormat("bold")),h("isItalic",x.hasFormat("italic")),h("isUnderline",x.hasFormat("underline")),h("isStrikethrough",x.hasFormat("strikethrough")),h("isSuperscript",x.hasFormat("superscript")),h("isSubscript",x.hasFormat("subscript")),h("isCode",x.hasFormat("code")))},[r,e,h]);F(()=>e.registerCommand(gn,(x,C)=>(i(C),g(),!1),Nt),[e,g,i]),F(()=>{r.getEditorState().read(()=>{g()})},[r,g]),F(()=>He(e.registerEditableListener(x=>{u(x)}),r.registerUpdateListener(({editorState:x})=>{x.read(()=>{g()})}),r.registerCommand(As,x=>(h("canUndo",x),!1),Nt),r.registerCommand(Is,x=>(h("canRedo",x),!1),Nt)),[g,r,e,h]);let m=Ne(()=>{p.isLink?(s(!1),r.dispatchCommand(Gn,null)):(s(!0),r.dispatchCommand(Gn,PL("https://")))},[r,s,p.isLink]),_=X(()=>n?[...n].sort((x,C)=>{let E=x.label||x.name,k=C.label||C.name;return E.localeCompare(k)}):[],[n]),b=X(()=>o?[...o].sort((x,C)=>{let E=x.label||x.name,k=C.label||C.name;return E.localeCompare(k)}):[],[o]),y=x=>{switch(x){case"image":return f($E,{size:16});case"html":return f(dE,{size:16});default:break}return f(GE,{size:16})},v=a==="comment";return f("div",{className:xe("LexicalEditor__toolbar",v&&"LexicalEditor__toolbar--comment"),children:[!v&&p.blockType in ch&&r===e&&f(ke,{children:[f(LW,{disabled:!d,blockType:p.blockType,rootType:p.rootType,editor:r}),f(vd,{})]}),f(ke,{children:[f("div",{className:"LexicalEditor__toolbar__group",children:[f(In,{tooltip:`Bold (${tn.BOLD})`,active:p.isBold,onClick:()=>{r.dispatchCommand(at,"bold")},children:f(Ud,{size:16})}),f(In,{tooltip:`Italic (${tn.ITALIC})`,active:p.isItalic,onClick:()=>{r.dispatchCommand(at,"italic")},children:f(Yd,{size:16})}),f(In,{tooltip:`Underline (${tn.UNDERLINE})`,active:p.isUnderline,onClick:()=>{r.dispatchCommand(at,"underline")},children:f(ru,{size:16})}),f(RW,{editor:r,isStrikethrough:p.isStrikethrough,isSuperscript:p.isSuperscript,isSubscript:p.isSubscript,isCode:p.isCode})]}),f(vd,{}),f("div",{className:"LexicalEditor__toolbar__group",children:f(In,{tooltip:`Insert link (${tn.INSERT_LINK})`,active:p.isLink,onClick:m,children:f(qd,{size:16})})}),f(vd,{}),f(In,{tooltip:`Clear formatting (${tn.CLEAR_FORMATTING})`,onClick:()=>{Tl(r)},children:f(Kd,{size:16})}),f(vd,{}),!v&&f(ke,{children:[f(G,{control:f(Z,{className:xe("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__insertDropdown"),variant:"default",compact:!0,leftIcon:f(UE,{size:16}),rightIcon:f(fo,{size:16}),children:"Components"}),children:[f(G.Label,{children:"Insert"}),f(G.Item,{icon:f(ou,{size:16}),onClick:()=>{r.dispatchCommand(xM,{columns:"3",rows:"3"})},children:"Table"}),f(G.Item,{icon:f(WE,{size:16}),onClick:()=>{r.dispatchCommand(Wf,void 0)},children:"Horizontal Rule"}),b.length>0&&f(ke,{children:[f(G.Label,{children:"Inline Components"}),b.map(x=>f(G.Item,{icon:f(uE,{size:16}),onClick:()=>c?.(x.name),children:x.label||x.name},x.name))]}),_.length>0&&f(ke,{children:[f(G.Label,{children:"Block Components"}),_.map(x=>f(G.Item,{icon:y(x.name),onClick:()=>l?.(x.name),children:x.label||x.name},x.name))]})]}),f(vd,{})]})]})]})}function In(t){return f(De,{className:xe("LexicalEditor__toolbar__actionIcon",t.active&&"LexicalEditor__toolbar__actionIcon--active"),label:t.tooltip,position:"top",withArrow:!0,children:f(Ae,{variant:t.variant||"default",onClick:t.onClick,title:t.tooltip,children:t.children})})}var PW=12,FW=5;function BW(t){let{editor:e,anchorElem:n,isLink:o,isBold:r,isCode:i,isItalic:s,isUnderline:a,isStrikethrough:l,isSubscript:c,isSuperscript:d,setIsLinkEditMode:u}=t,p=J(null),h=Ne(()=>{o?(u(!1),e.dispatchCommand(Gn,null)):(u(!0),e.dispatchCommand(Gn,""))},[e,o,u]);function g(b){if(p?.current&&(b.buttons===1||b.buttons===3)&&p.current.style.pointerEvents!=="none"){let y=b.clientX,v=b.clientY,x=document.elementFromPoint(y,v);p.current.contains(x)||(p.current.style.pointerEvents="none")}}function m(){p?.current&&p.current.style.pointerEvents!=="auto"&&(p.current.style.pointerEvents="auto")}F(()=>{if(p?.current)return document.addEventListener("mousemove",g),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",m)}},[p]);let _=Ne(()=>{let b=z(),y=p.current,v=so(e._window);if(y===null)return;let x=e.getRootElement();if(b!==null&&v!==null&&!v.isCollapsed&&x!==null&&x.contains(v.anchorNode)){let C=nL(v,x);zW(C,y,n,o)}},[e,n,o]);return F(()=>{let b=n.parentElement,y=()=>{e.getEditorState().read(()=>{_()})};return window.addEventListener("resize",y),b&&b.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),b&&b.removeEventListener("scroll",y)}},[e,_,n]),F(()=>(e.getEditorState().read(()=>{_()}),He(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{_()})}),e.registerCommand(gn,()=>(_(),!1),Re))),[e,_]),f("div",{ref:p,className:"LexicalEditor__floatingToolbar",children:e.isEditable()&&f(ke,{children:[f(In,{variant:"hover",tooltip:`Bold (${tn.BOLD})`,active:r,onClick:()=>{e.dispatchCommand(at,"bold")},children:f(Ud,{size:16})}),f(In,{variant:"hover",tooltip:`Italic (${tn.ITALIC})`,active:s,onClick:()=>{e.dispatchCommand(at,"italic")},children:f(Yd,{size:16})}),f(In,{variant:"hover",tooltip:`Underline (${tn.UNDERLINE})`,active:a,onClick:()=>{e.dispatchCommand(at,"underline")},children:f(ru,{size:16})}),f(In,{variant:"hover",tooltip:`Strikethrough (${tn.STRIKETHROUGH})`,active:l,onClick:()=>{e.dispatchCommand(at,"strikethrough")},children:f(eu,{size:16})}),f(In,{variant:"hover",tooltip:`Superscript (${tn.SUPERSCRIPT})`,active:d,onClick:()=>{e.dispatchCommand(at,"superscript")},children:f(nu,{size:16})}),f(In,{variant:"hover",tooltip:`Subscript (${tn.SUBSCRIPT})`,active:c,onClick:()=>{e.dispatchCommand(at,"subscript")},children:f(tu,{size:16})}),f(In,{variant:"hover",tooltip:"Code",active:i,onClick:()=>{e.dispatchCommand(at,"code")},children:f(Vd,{size:16})}),f(In,{variant:"hover",tooltip:`Insert link (${tn.INSERT_LINK})`,active:o,onClick:h,children:f(qd,{size:16})}),f(In,{variant:"hover",tooltip:`Clear formatting (${tn.CLEAR_FORMATTING})`,onClick:()=>{Tl(e)},children:f(Kd,{size:16})})]})})}function $W(t,e,n){let[o,r]=L(!1),[i,s]=L(!1),[a,l]=L(!1),[c,d]=L(!1),[u,p]=L(!1),[h,g]=L(!1),[m,_]=L(!1),[b,y]=L(!1),[v,x]=L(!1),C=Ne(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let E=z(),k=so(t._window),T=t.getRootElement();if(k!==null&&(!B(E)||T===null||!T.contains(k.anchorNode))){r(!1);return}if(!B(E))return;let w=Zr(E);l(E.hasFormat("bold")),d(E.hasFormat("code")),p(E.hasFormat("italic")),y(E.hasFormat("underline")),g(E.hasFormat("strikethrough")),_(E.hasFormat("subscript")),x(E.hasFormat("superscript"));let S=w.getParent();Qe(S)||Qe(w)?s(!0):s(!1),!CL(E.anchor.getNode())&&E.getTextContent()!==""?r(te(w)||Qt(w)):r(!1);let N=E.getTextContent().replace(/\n/g,"");if(!E.isCollapsed()&&N===""){r(!1);return}})},[t]);return F(()=>(document.addEventListener("selectionchange",C),()=>{document.removeEventListener("selectionchange",C)}),[C]),F(()=>He(t.registerUpdateListener(()=>{C()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),[t,C]),o?ii(f(BW,{editor:t,anchorElem:e,isLink:i,isBold:a,isCode:c,isItalic:u,isStrikethrough:h,isSubscript:m,isSuperscript:v,isUnderline:b,setIsLinkEditMode:n}),e):null}function BL(t){let{anchorElem:e=document.body,setIsLinkEditMode:n}=t,[o]=ve();return $W(o,e,n)}function zW(t,e,n,o=!1,r=PW,i=FW){let s=n.parentElement;if(t===null||!s){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let a=e.getBoundingClientRect(),l=n.getBoundingClientRect(),c=s.getBoundingClientRect(),d=t.top-a.height-r,u=t.left-i,p=window.getSelection();if(p&&p.rangeCount>0){let g=p.getRangeAt(0).startContainer;if(g.nodeType===Node.ELEMENT_NODE||g.parentElement){let m=g.nodeType===Node.ELEMENT_NODE?g:g.parentElement,_=window.getComputedStyle(m).textAlign;(_==="right"||_==="end")&&(u=t.right-a.width+i)}}d<c.top&&(d+=a.height+t.height+r*(o?9:2)),u+a.width>c.right&&(u=c.right-a.width-i),u<c.left&&(u=c.left+i),d-=l.top,u-=l.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${d}px)`}Se();function $L(){let[t]=ve();F(()=>t.registerCommand(Pi,n=>{let{clipboardData:o}=n;if(!o)return!1;let i=Array.from(o.files).find(s=>s.type.startsWith("image/"));return i?(n.preventDefault(),e(i),!0):!1},Re),[t]);let e=async n=>{let o=URL.createObjectURL(n),r=null;t.update(()=>{let i=js("image",{file:{src:o,width:0,height:0},loading:!0}),s=z();if(B(s)){$o([i]);let a=ge();i.insertAfter(a),a.select()}r=i.getKey()});try{let i=await ai(n);t.update(()=>{if(r){let s=Mt(r);Xr(s)&&s.setBlockData({file:i,loading:!1})}})}catch(i){console.error("Failed to upload image",i),ae({type:"error",message:"Failed to upload image"})}};return null}var uC={};$e(uC,{$convertFromMarkdownString:()=>QW,$convertToMarkdownString:()=>eG,BOLD_ITALIC_STAR:()=>rR,BOLD_ITALIC_UNDERSCORE:()=>iR,BOLD_STAR:()=>sR,BOLD_UNDERSCORE:()=>aR,CHECK_LIST:()=>ZW,CODE:()=>QL,ELEMENT_TRANSFORMERS:()=>pR,HEADING:()=>XL,HIGHLIGHT:()=>oR,INLINE_CODE:()=>nR,ITALIC_STAR:()=>cR,ITALIC_UNDERSCORE:()=>dR,LINK:()=>uR,MULTILINE_ELEMENT_TRANSFORMERS:()=>fR,ORDERED_LIST:()=>tR,QUOTE:()=>ZL,STRIKETHROUGH:()=>lR,TEXT_FORMAT_TRANSFORMERS:()=>hR,TEXT_MATCH_TRANSFORMERS:()=>gR,TRANSFORMERS:()=>Eh,UNORDERED_LIST:()=>eR,registerMarkdownShortcuts:()=>YW});function sC(t,e){let n={};for(let o of t){let r=e(o);r&&(n[r]?n[r].push(o):n[r]=[o])}return n}function cC(t){let e=sC(t,(n=>n.type));return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}var xh=/[!-/:-@[-`{-~\s]/,HW=/^\s{0,3}$/;function aC(t){if(!Qt(t))return!1;let e=t.getFirstChild();return e==null||t.getChildrenSize()===1&&te(e)&&HW.test(e.getTextContent())}function UW(t,e,n,o){for(let r of e){if(!r.export)continue;let i=r.export(t,(s=>vh(s,n,o)));if(i!=null)return i}return Y(t)?vh(t,n,o):Hn(t)?t.getTextContent():null}function vh(t,e,n,o,r){let i=[],s=t.getChildren();o||(o=[]),r||(r=[]);e:for(let a of s){for(let l of n){if(!l.export)continue;let c=l.export(a,(d=>vh(d,e,n,o,[...r,...o])),((d,u)=>zL(d,u,e,o,r)));if(c!=null){i.push(c);continue e}}Ze(a)?i.push(`
130
+ `):te(a)?i.push(zL(a,a.getTextContent(),e,o,r)):Y(a)?i.push(vh(a,e,n,o,r)):Hn(a)&&i.push(a.getTextContent())}return i.join("")}function zL(t,e,n,o,r){let i=t.getFormat()===0?e:(function(p){return p.replace(/^\s+|\s+$/g,(h=>[...h].map((g=>"&#"+g.codePointAt(0)+";")).join("")))})(e);t.hasFormat("code")||(i=i.replace(/([*_`~\\])/g,"\\$1"));let s="",a="",l="",c=HL(t,!0),d=HL(t,!1),u=new Set;for(let p of n){let h=p.format[0],g=p.tag;yh(t,h)&&!u.has(h)&&(u.add(h),yh(c,h)&&o.find((m=>m.tag===g))||(o.push({format:h,tag:g}),s+=g))}for(let p=0;p<o.length;p++){let h=yh(t,o[p].format),g=yh(d,o[p].format);if(h&&g)continue;let m=[...o];for(;m.length>p;){let _=m.pop();r&&_&&r.find((b=>b.tag===_.tag))||(_&&typeof _.tag=="string"&&(h?g||(l+=_.tag):a+=_.tag),o.pop())}break}return i=s+i+l,a+i}function HL(t,e){let n=e?t.getPreviousSibling():t.getNextSibling();if(!n){let o=t.getParentOrThrow();o.isInline()&&(n=e?o.getPreviousSibling():o.getNextSibling())}for(;n;){if(Y(n)){if(!n.isInline())break;let o=e?n.getLastDescendant():n.getFirstDescendant();if(te(o))return o;n=e?n.getPreviousSibling():n.getNextSibling()}if(te(n))return n;if(!Y(n))return null}return null}function yh(t,e){return te(t)&&t.hasFormat(e)}function KW(t,e){let n=(function(r,i){let s=r.match(i.openTagsRegExp);if(s==null)return null;for(let a of s){let l=a.replace(/^\s/,""),c=i.fullMatchRegExpByTag[l];if(c==null)continue;let d=r.match(c),u=i.transformersByTag[l];if(d!=null&&u!=null){if(u.intraword!==!1)return d;let{index:p=0}=d,h=r[p-1],g=r[p+d[0].length];if((!h||xh.test(h))&&(!g||xh.test(g)))return d}}return null})(t.getTextContent(),e);if(!n)return null;let o=n.index||0;return{endIndex:o+n[0].length,match:n,startIndex:o,transformer:e.transformersByTag[n[1]]}}function qs(t){return te(t)&&!t.hasFormat("code")}function Js(t,e,n){let o=KW(t,e),r=(function(s,a){let l=s,c,d,u,p;for(let h of a){if(!h.replace||!h.importRegExp)continue;let g=l.getTextContent().match(h.importRegExp);if(!g)continue;let m=g.index||0,_=h.getEndIndex?h.getEndIndex(l,g):m+g[0].length;_!==!1&&(c===void 0||d===void 0||m<c&&_>d)&&(c=m,d=_,u=h,p=g)}return c===void 0||d===void 0||u===void 0||p===void 0?null:{endIndex:d,match:p,startIndex:c,transformer:u}})(t,n);if(o&&r&&(o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null),o){let s=(function(a,l,c,d,u){let p=a.getTextContent(),h,g,m;if(u[0]===p?h=a:l===0?[h,g]=a.splitText(c):[m,h,g]=a.splitText(l,c),h.setTextContent(u[2]),d)for(let _ of d.format)h.hasFormat(_)||h.toggleFormat(_);return{nodeAfter:g,nodeBefore:m,transformedNode:h}})(t,o.startIndex,o.endIndex,o.transformer,o.match);qs(s.nodeAfter)&&Js(s.nodeAfter,e,n),qs(s.nodeBefore)&&Js(s.nodeBefore,e,n),qs(s.transformedNode)&&Js(s.transformedNode,e,n)}else if(r){let s=(function(a,l,c,d,u){let p,h,g;return l===0?[p,h]=a.splitText(c):[g,p,h]=a.splitText(l,c),d.replace?{nodeAfter:h,nodeBefore:g,transformedNode:d.replace(p,u)||void 0}:null})(t,r.startIndex,r.endIndex,r.transformer,r.match);if(!s)return;qs(s.nodeAfter)&&Js(s.nodeAfter,e,n),qs(s.nodeBefore)&&Js(s.nodeBefore,e,n),qs(s.transformedNode)&&Js(s.transformedNode,e,n)}let i=t.getTextContent().replace(/\\([*_`~\\])/g,"$1").replace(/&#(\d+);/g,((s,a)=>String.fromCodePoint(a)));t.setTextContent(i)}function jW(t,e=!1){let n=cC(t),o=(function(r){let i={},s={},a=[],l="(?<![\\\\])";for(let c of r){let{tag:d}=c;i[d]=c;let u=d.replace(/(\*|\^|\+)/g,"\\$1");a.push(u),d.length===1?s[d]=new RegExp(`(?<![\\\\${u}])(${u})((\\\\${u})?.*?[^${u}\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?![\\\\${u}])`):s[d]=new RegExp(`(?<!\\\\)(${u})((\\\\${u})?.*?[^\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?!\\\\)`)}return{fullMatchRegExpByTag:s,openTagsRegExp:new RegExp(`${l}(${a.join("|")})`,"g"),transformersByTag:i}})(n.textFormat);return(r,i)=>{let s=r.split(`
131
+ `),a=s.length,l=i||tt();l.clear();for(let d=0;d<a;d++){let u=s[d],[p,h]=VW(s,d,n.multilineElement,l);p?d=h:WW(u,l,n.element,o,n.textMatch,e)}let c=l.getChildren();for(let d of c)!e&&aC(d)&&l.getChildrenSize()>1&&d.remove();z()!==null&&l.selectStart()}}function VW(t,e,n,o){for(let r of n){let{handleImportAfterStartMatch:i,regExpEnd:s,regExpStart:a,replace:l}=r,c=t[e].match(a);if(!c)continue;if(i){let g=i({lines:t,rootNode:o,startLineIndex:e,startMatch:c,transformer:r});if(g===null)continue;if(g)return g}let d=typeof s=="object"&&"regExp"in s?s.regExp:s,u=s&&typeof s=="object"&&"optional"in s?s.optional:!s,p=e,h=t.length;for(;p<h;){let g=d?t[p].match(d):null;if(!g&&(!u||u&&p<h-1)){p++;continue}if(g&&e===p&&g.index===c.index){p++;continue}let m=[];if(g&&e===p)m.push(t[e].slice(c[0].length,-g[0].length));else for(let _=e;_<=p;_++)if(_===e){let b=t[_].slice(c[0].length);m.push(b)}else if(_===p&&g){let b=t[_].slice(0,-g[0].length);m.push(b)}else m.push(t[_]);if(l(o,null,c,g,m,!0)!==!1)return[!0,p];break}}return[!1,e]}function WW(t,e,n,o,r,i){let s=kt(t),a=ge();a.append(s),e.append(a);for(let{regExp:l,replace:c}of n){let d=t.match(l);if(d&&(s.setTextContent(t.slice(d[0].length)),c(a,[s],d,!0)!==!1))break}if(Js(s,o,r),a.isAttached()&&t.length>0){let l=a.getPreviousSibling();if(!i&&(Qt(l)||Yr(l)||Dn(l))){let c=l;if(Dn(l)){let d=l.getLastDescendant();c=d==null?null:ue(d,cd)}c!=null&&c.getTextContentSize()>0&&(c.splice(c.getChildrenSize(),0,[Fo(),...a.getChildren()]),a.remove())}}}function GW(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function UL(t,e,n){let o=n.length;for(let r=e;r>=o;r--){let i=r-o;if(KL(t,i,n,0,o)&&t[i+o]!==" ")return i}return-1}function KL(t,e,n,o,r){for(let i=0;i<r;i++)if(t[e+i]!==n[o+i])return!1;return!0}function YW(t,e=Eh){let n=cC(e),o=sC(n.textFormat,(({tag:s})=>s[s.length-1])),r=sC(n.textMatch,(({trigger:s})=>s));for(let s of e){let a=s.type;if(a==="element"||a==="text-match"||a==="multiline-element"){let l=s.dependencies;for(let c of l)t.hasNode(c)||GW(173,c.getType())}}let i=(s,a,l)=>{(function(c,d,u,p){let h=c.getParent();if(!zt(h)||c.getFirstChild()!==d)return!1;let g=d.getTextContent();if(g[u-1]!==" ")return!1;for(let{regExp:m,replace:_}of p){let b=g.match(m);if(b&&b[0].length===(b[0].endsWith(" ")?u:u-1)){let y=d.getNextSiblings(),[v,x]=d.splitText(u);if(_(c,x?[x,...y]:y,b,!1)!==!1)return v.remove(),!0}}return!1})(s,a,l,n.element)||(function(c,d,u,p){let h=c.getParent();if(!zt(h)||c.getFirstChild()!==d)return!1;let g=d.getTextContent();if(g[u-1]!==" ")return!1;for(let{regExpStart:m,replace:_,regExpEnd:b}of p){if(b&&!("optional"in b)||b&&"optional"in b&&!b.optional)continue;let y=g.match(m);if(y&&y[0].length===(y[0].endsWith(" ")?u:u-1)){let v=d.getNextSiblings(),[x,C]=d.splitText(u);if(_(c,C?[C,...v]:v,y,null,null,!1)!==!1)return x.remove(),!0}}return!1})(s,a,l,n.multilineElement)||(function(c,d,u){let p=c.getTextContent(),h=u[p[d-1]];if(h==null)return!1;d<p.length&&(p=p.slice(0,d));for(let g of h){if(!g.replace||!g.regExp)continue;let m=p.match(g.regExp);if(m===null)continue;let _=m.index||0,b=_+m[0].length,y;return _===0?[y]=c.splitText(b):[,y]=c.splitText(_,b),y.selectNext(0,0),g.replace(y,m),!0}return!1})(a,l,r)||(function(c,d,u){let p=c.getTextContent(),h=d-1,g=p[h],m=u[g];if(!m)return!1;for(let _ of m){let{tag:b}=_,y=b.length,v=h-y+1;if(y>1&&!KL(p,v,b,0,y)||p[v-1]===" ")continue;let x=p[h+1];if(_.intraword===!1&&x&&!xh.test(x))continue;let C=c,E=C,k=UL(p,v,b),T=E;for(;k<0&&(T=T.getPreviousSibling())&&!Ze(T);)if(te(T)){if(T.hasFormat("code"))continue;let $=T.getTextContent();E=T,k=UL($,$.length,b)}if(k<0||E===C&&k+y===v)continue;let w=E.getTextContent();if(k>0&&w[k-1]===g)continue;let S=w[k-1];if(_.intraword===!1&&S&&!xh.test(S))continue;let N=C.getTextContent(),D=N.slice(0,v)+N.slice(h+1);C.setTextContent(D);let O=E===C?D:w;E.setTextContent(O.slice(0,k)+O.slice(k+y));let A=z(),I=sr();vt(I);let R=h-y*(E===C?2:1)+1;I.anchor.set(E.__key,k,"text"),I.focus.set(C.__key,R,"text");for(let $ of _.format)I.hasFormat($)||I.formatText($);I.anchor.set(I.focus.key,I.focus.offset,I.focus.type);for(let $ of _.format)I.hasFormat($)&&I.toggleFormat($);return B(A)&&(I.format=A.format),!0}})(a,l,o)};return t.registerUpdateListener((({tags:s,dirtyLeaves:a,editorState:l,prevEditorState:c})=>{if(s.has(dO)||s.has(nl)||t.isComposing())return;let d=l.read(z),u=c.read(z);if(!B(u)||!B(d)||!d.isCollapsed()||d.is(u))return;let p=d.anchor.key,h=d.anchor.offset,g=l._nodeMap.get(p);!te(g)||!a.has(p)||h!==1&&h>u.anchor.offset+1||t.update((()=>{if(!qs(g))return;let m=g.getParent();m===null||iC(m)||i(m,g,d.anchor.offset)}))}))}var jL=/^(\s*)(\d{1,})\.\s/,VL=/^(\s*)[-*+]\s/,WL=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,lC=/^(#{1,6})\s/,GL=/^>\s/,YL=/^[ \t]*```([\w-]+)?/,qL=/[ \t]*```$/,qW=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,JW=/^(?:\|)(.+)(?:\|)\s?$/,XW=/^(\| ?:?-*:? ?)+\|\s?$/,JL=t=>(e,n,o,r)=>{let i=t(o);i.append(...n),e.replace(i),r||i.select(0,0)},dC=t=>(e,n,o,r)=>{let i=e.getPreviousSibling(),s=e.getNextSibling(),a=ld(t==="check"?o[3]==="x":void 0);if(Dn(s)&&s.getListType()===t){let c=s.getFirstChild();c!==null?c.insertBefore(a):s.append(a),e.remove()}else if(Dn(i)&&i.getListType()===t)i.append(a),e.remove();else{let c=cl(t,t==="number"?Number(o[2]):void 0);c.append(a),e.replace(c)}a.append(...n),r||a.select(0,0);let l=(function(c){let d=c.match(/\t/g),u=c.match(/ /g),p=0;return d&&(p+=d.length),u&&(p+=Math.floor(u.length/4)),p})(o[1]);l&&a.setIndent(l)},Ch=(t,e,n)=>{let o=[],r=t.getChildren(),i=0;for(let s of r)if(cd(s)){if(s.getChildrenSize()===1){let d=s.getFirstChild();if(Dn(d)){o.push(Ch(d,e,n+1));continue}}let a=" ".repeat(4*n),l=t.getListType(),c=l==="number"?`${t.getStart()+i}. `:l==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(a+c+e(s)),i++}return o.join(`
132
+ `)},XL={dependencies:[qf],export:(t,e)=>{if(!Gr(t))return null;let n=Number(t.getTag().slice(1));return"#".repeat(n)+" "+e(t)},regExp:lC,replace:JL((t=>{let e="h"+t[1].length;return $s(e)})),type:"element"},ZL={dependencies:[Jf],export:(t,e)=>{if(!Yr(t))return null;let n=e(t).split(`
133
+ `),o=[];for(let r of n)o.push("> "+r);return o.join(`
134
+ `)},regExp:GL,replace:(t,e,n,o)=>{if(o){let i=t.getPreviousSibling();if(Yr(i))return i.splice(i.getChildrenSize(),0,[Fo(),...e]),void t.remove()}let r=zs();r.append(...e),t.replace(r),o||r.select(0,0)},type:"element"},QL={dependencies:[EL],export:t=>{if(!iC(t))return null;let e=t.getTextContent();return"```"+(t.getLanguage()||"")+(e?`
135
+ `+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:qL},regExpStart:YL,replace:(t,e,n,o,r,i)=>{let s,a;if(!e&&r){if(r.length===1)o?(s=xd(),a=n[1]+r[0]):(s=xd(n[1]),a=r[0].startsWith(" ")?r[0].slice(1):r[0]);else{if(s=xd(n[1]),r[0].trim().length===0)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();a=r.join(`
136
+ `)}let l=kt(a);s.append(l),t.append(s)}else e&&JL((l=>xd(l?l[1]:void 0)))(t,e,n,i)},type:"multiline-element"},eR={dependencies:[fr,zi],export:(t,e)=>Dn(t)?Ch(t,e,0):null,regExp:VL,replace:dC("bullet"),type:"element"},ZW={dependencies:[fr,zi],export:(t,e)=>Dn(t)?Ch(t,e,0):null,regExp:WL,replace:dC("check"),type:"element"},tR={dependencies:[fr,zi],export:(t,e)=>Dn(t)?Ch(t,e,0):null,regExp:jL,replace:dC("number"),type:"element"},nR={format:["code"],tag:"`",type:"text-format"},oR={format:["highlight"],tag:"==",type:"text-format"},rR={format:["bold","italic"],tag:"***",type:"text-format"},iR={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},sR={format:["bold"],tag:"**",type:"text-format"},aR={format:["bold"],intraword:!1,tag:"__",type:"text-format"},lR={format:["strikethrough"],tag:"~~",type:"text-format"},cR={format:["italic"],tag:"*",type:"text-format"},dR={format:["italic"],intraword:!1,tag:"_",type:"text-format"},uR={dependencies:[al],export:(t,e,n)=>{if(!Qe(t)||sd(t))return null;let o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{let[,n,o,r]=e,i=Rf(o,{title:r}),s=kt(n);return s.setFormat(t.getFormat()),i.append(s),t.replace(i),s},trigger:")",type:"text-match"},pR=[XL,ZL,eR,tR],fR=[QL],hR=[nR,rR,iR,sR,aR,oR,cR,dR,lR],gR=[uR],Eh=[...pR,...fR,...hR,...gR];function QW(t,e=Eh,n,o=!1,r=!1){let i=o?t:(function(s,a=!1){let l=s.split(`
137
+ `),c=!1,d=[];for(let u=0;u<l.length;u++){let p=l[u],h=d[d.length-1];qW.test(p)?d.push(p):YL.test(p)||qL.test(p)?(c=!c,d.push(p)):c||p===""||h===""||!h||lC.test(h)||lC.test(p)||GL.test(p)||jL.test(p)||VL.test(p)||WL.test(p)||JW.test(p)||XW.test(p)||!a?d.push(p):d[d.length-1]=h+p}return d.join(`
138
+ `)})(t,r);return jW(e,o)(i,n)}function eG(t=Eh,e,n=!1){return(function(r,i=!1){let s=cC(r),a=[...s.multilineElement,...s.element],l=!i,c=s.textFormat.filter((d=>d.format.length===1)).sort(((d,u)=>Number(d.format.includes("code"))-Number(u.format.includes("code"))));return d=>{let u=[],p=(d||tt()).getChildren();for(let h=0;h<p.length;h++){let g=p[h],m=UW(g,a,c,s.textMatch);m!=null&&u.push(l&&h>0&&!aC(g)&&!aC(p[h-1])?`
139
+ `.concat(m):m)}return u.join(`
140
+ `)}})(t,n)(e)}var ct=uC,xue=ct.$convertFromMarkdownString,vue=ct.$convertToMarkdownString,Cue=ct.BOLD_ITALIC_STAR,Eue=ct.BOLD_ITALIC_UNDERSCORE,wue=ct.BOLD_STAR,Tue=ct.BOLD_UNDERSCORE,Sue=ct.CHECK_LIST,kue=ct.CODE,Nue=ct.ELEMENT_TRANSFORMERS,mR=ct.HEADING,Due=ct.HIGHLIGHT,_R=ct.INLINE_CODE,Oue=ct.ITALIC_STAR,Iue=ct.ITALIC_UNDERSCORE,Aue=ct.LINK,Mue=ct.MULTILINE_ELEMENT_TRANSFORMERS,bR=ct.ORDERED_LIST,yR=ct.QUOTE,Lue=ct.STRIKETHROUGH,Rue=ct.TEXT_FORMAT_TRANSFORMERS,Pue=ct.TEXT_MATCH_TRANSFORMERS,xR=ct.TRANSFORMERS,vR=ct.UNORDERED_LIST,CR=ct.registerMarkdownShortcuts;var pC={};$e(pC,{DEFAULT_TRANSFORMERS:()=>ER,MarkdownShortcutPlugin:()=>tG});bt();var ER=[{dependencies:[Vf],export:t=>pA(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,o)=>{let r=dl();o||t.getNextSibling()!=null?t.replace(r):t.insertBefore(r),r.selectNext()},type:"element"},...xR];function tG({transformers:t=ER}){let[e]=ve();return F((()=>CR(e,t)),[e,t]),null}var wR=pC,Uue=wR.DEFAULT_TRANSFORMERS,TR=wR.MarkdownShortcutPlugin;function SR(){return f(TR,{transformers:[mR,vR,bR,yR,_R]})}var fC={};$e(fC,{OnChangePlugin:()=>oG});bt();var nG=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?_n:F;function oG({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:n}){let[o]=ve();return nG((()=>{if(n)return o.registerUpdateListener((({editorState:r,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{e&&i.size===0&&s.size===0||t&&l.has(ol)||a.isEmpty()||n(r,o,l)}))}),[o,t,e,n]),null}var rG=fC,kR=rG.OnChangePlugin;Se();function iG(){return{text:"",components:{}}}var sG=[{tag:"code",format:"code"},{tag:"s",format:"strikethrough"},{tag:"u",format:"underline"},{tag:"i",format:"italic"},{tag:"b",format:"bold"},{tag:"sup",format:"superscript"},{tag:"sub",format:"subscript"}];function DR(t){let e=[];return sG.forEach(({tag:n,format:o})=>{t.hasFormat(o)&&e.push(n)}),e}function hC(t,e){t.text+=e.text,Object.assign(t.components,e.components)}function aG(t,e,n){for(let o=t.length-1;o>=0;o-=1){let r=t[o];e.includes(r)||(n.text+=`</${r}>`,t.splice(o,1))}e.forEach(o=>{t.includes(o)||(n.text+=`<${o}>`,t.push(o))})}function NR(t,e){for(let n=t.length-1;n>=0;n-=1)e.text+=`</${t[n]}>`;t.length=0}function OR(t,e){let n=t.getChildren();for(let o of n)if(te(o)){let r=DR(o);if(r.length!==e.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==e[i])return!1}else{if(Ze(o)||El(o))continue;if(o instanceof Ht){if(!OR(o,e))return!1}else return!1}return!0}function lG(t){let e=t.getComponentId(),n=t.getComponentName(),o=et(t.getComponentData()),r={[e]:{type:n,data:o}};return{text:`{${n}:${e}}`,components:r}}function cG(t){let e=Qe(t)&&t.getURL()||"",n=Qe(t)&&t.getTarget()||"",o=ei(t),r=gG(n)?` target="${n}"`:"";return{text:`<a href="${e}"${r}>${o.text}</a>`,components:o.components}}function ei(t){let e=iG(),n=[];return t.getChildren().forEach(r=>{if(Ze(r)){e.text+="<br>";return}if(El(r)){hC(e,lG(r));return}if(te(r)){let i=DR(r);aG(n,i,e);let s=r.getTextContent();s&&(e.text+=fG(s));return}if(Qe(r)){n.length>0&&!OR(r,n)&&NR(n,e),hC(e,cG(r));return}if(r instanceof Ht){hC(e,ei(r));return}console.log("unhandled node"),console.log(r)}),n.length>0&&NR(n,e),e}function gC(t){let e=[];return t.getChildren().forEach(n=>{cd(n)&&e.push(dG(n))}),hG(e)}function dG(t){let e=t.getFirstChild();if(e&&Dn(e))return{itemsType:e.getTag()==="ol"?"orderedList":"unorderedList",items:gC(e)};let n=ei(t),o={content:n.text};return Yi(n.components)&&(o.components=n.components),o}function uG(t){let e=[];return t.getChildren().forEach(n=>{if(wo(n)){let o=[];n.getChildren().forEach(r=>{if(Ko(r)){let s=r.getHeaderStyles()>0,a=r.getChildren(),l=[];a.forEach(c=>{if(Xr(c))l.push({type:c.getBlockName(),data:et(c.getBlockData())});else if(Qt(c)){let d=ei(c),u={type:"paragraph",data:{text:d.text}};Yi(d.components)&&(u.data.components=d.components),l.push(u)}else if(Gr(c)){let d=c.getTag().slice(1),u=ei(c),p={type:"heading",data:{text:u.text,level:parseInt(d)}};Yi(u.components)&&(p.data.components=u.components),l.push(p)}else if(Yr(c)){let d=ei(c),u={type:"quote",data:{text:d.text}};Yi(d.components)&&(u.data.components=d.components),l.push(u)}else if(Dn(c)){let d=c.getTag(),u={type:d==="ol"?"orderedList":"unorderedList",data:{style:d==="ol"?"ordered":"unordered",items:gC(c)}};l.push(u)}}),o.push({blocks:l,type:s?"header":"data"})}}),e.push({cells:o})}}),{rows:e}}function IR(){let t=[];for(tt().getChildren().forEach(o=>{if(Qt(o)){let r=ei(o),i={type:"paragraph",data:{text:r.text}};Yi(r.components)&&(i.data.components=r.components),t.push(i)}else if(Gr(o)){let r=o.getTag().slice(1),i=ei(o),s={type:"heading",data:{text:i.text,level:parseInt(r)}};Yi(i.components)&&(s.data.components=i.components),t.push(s)}else if(Yr(o)){let r=ei(o),i={type:"quote",data:{text:r.text}};Yi(r.components)&&(i.data.components=r.components),t.push(i)}else if(Dn(o)){let r=o.getTag(),i={type:r==="ol"?"orderedList":"unorderedList",data:{style:r==="ol"?"ordered":"unordered",items:gC(o)}};t.push(i)}else if(bM(o)){let i={type:"table",data:uG(o)};t.push(i)}else if(Xr(o)){let r={type:o.getBlockName(),data:et(o.getBlockData())};t.push(r)}else if(Hn(o)&&o.getType()==="horizontalrule"){let r={type:"delimiter",data:{}};t.push(r)}});pG(t);)t.pop();return t.length===0?null:{time:Date.now(),blocks:t,version:"lexical-0.31.2"}}function pG(t){let e=t.length>0&&t.at(-1);return!!(e&&e.type==="paragraph"&&!e.data?.text&&!Yi(e.data?.components||{}))}function Yi(t){return t?Object.keys(t).length>0:!1}function fG(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function hG(t){let e=[];return t.forEach(n=>{n.itemsType&&n.items&&e.length>0?(e.at(-1).itemsType=n.itemsType,e.at(-1).items=n.items):e.push(n)}),e}function gG(t){return["_blank","_self","_parent","_top"].includes(t)}function AR(t){let e=tt();e.clear();let n=t?.blocks||[];for(let o of n)if(o.type==="paragraph"){let r=ge();if(o.data.text){let i=Xs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="heading"){let r=`h${o.data?.level||2}`,i=$s(r);if(o.data.text){let s=Xs(o.data.text,o.data.components);i.append(...s)}e.append(i)}else if(o.type==="quote"){let r=zs();if(o.data?.text){let i=Xs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="orderedList"||o.type==="unorderedList"){let r=o.data.style==="ordered"?"number":"bullet",i=cl(r);for(let s of o.data.items)i.append(...mC(s,r));e.append(i)}else if(o.type==="table"){let r=fM();(o.data?.rows||[]).forEach(s=>{let a=hM();(s.cells||[]).forEach(c=>{let d=c.blocks||[],p=(c.type||"data")==="header"?1:0,h=pM(p);d.forEach(g=>{if(g.type==="paragraph"){let m=ge();if(g.data?.text){let _=Xs(g.data.text,g.data.components);m.append(..._)}h.append(m)}else if(g.type==="heading"){let m=`h${g.data?.level||2}`,_=$s(m);if(g.data?.text){let b=Xs(g.data.text,g.data.components);_.append(...b)}h.append(_)}else if(g.type==="quote"){let m=zs();if(g.data?.text){let _=Xs(g.data.text,g.data.components);m.append(..._)}h.append(m)}else if(g.type==="orderedList"||g.type==="unorderedList"){let m=g.data.style==="ordered"?"number":"bullet",_=cl(m);for(let b of g.data.items)_.append(...mC(b,m));h.append(_)}else{let m=js(g.type,g.data||{});h.append(m)}}),a.append(h)}),r.append(a)}),e.append(r)}else if(o.type==="delimiter"){let r=dl();e.append(r)}else if(o.type){let r=js(o.type,o.data||{});e.append(r)}}function Xs(t,e){let n=document.createElement("template");n.innerHTML=t;let o=n.content,r=[];function i(s){if(s.nodeType===Node.TEXT_NODE)return mG(s.textContent||"",e);if(s.nodeType===Node.ELEMENT_NODE){let a=s,l=Array.from(a.childNodes).map(i).filter(c=>!!c).flat();switch(a.tagName.toLowerCase()){case"b":case"strong":return l.map(c=>(c instanceof Ut&&c.toggleFormat("bold"),c));case"i":case"em":return l.map(c=>(c instanceof Ut&&c.toggleFormat("italic"),c));case"u":return l.map(c=>(c instanceof Ut&&c.toggleFormat("underline"),c));case"s":return l.map(c=>(c instanceof Ut&&c.toggleFormat("strikethrough"),c));case"sup":return l.map(c=>(c instanceof Ut&&c.toggleFormat("superscript"),c));case"sub":return l.map(c=>(c instanceof Ut&&c.toggleFormat("subscript"),c));case"code":return l.map(c=>(c instanceof Ut&&c.toggleFormat("code"),c));case"br":return[];case"a":{let c=Rf(a.getAttribute("href")||""),d=a.getAttribute("target");return d&&c.setTarget(d),c.append(...l),[At(c)]}default:return console.log("unhandled tag: "+a.tagName),console.log(l),l}}return null}return o.childNodes.forEach(s=>{let a=i(s);Array.isArray(a)?r.push(...a):a&&r.push(a)}),r}function mG(t,e){let n=[];if(!t)return n;let o=/\{([^:{}]+):([^}]+)\}/g,r=0,i;for(;(i=o.exec(t))!==null;){let a=t.slice(r,i.index);a&&n.push(kt(a));let l=i[1],c=i[2],d=e?.[c];d?n.push(ph(l||d.type,c,d.data?et(d.data):{})):n.push(kt(i[0])),r=o.lastIndex}let s=t.slice(r);return s&&n.push(kt(s)),n}function mC(t,e){let n=[];if(t.content){let o=_G(t);n.push(o)}if(t.items&&t.items.length>0){let o=bG(t,e);n.push(o)}return n}function _G(t){let e=ld();if(t.content){let n=Xs(t.content,t.components);e.append(...n)}return e}function bG(t,e){let n=ld();if(t.items&&t.items.length>0){let o=e;t.itemsType==="orderedList"?o="number":t.itemsType==="unorderedList"&&(o="bullet");let r=cl(o);for(let i of t.items)r.append(...mC(i,o));n.append(r)}return n}function MR(t){let[e]=ve(),n=J(0),o=J(!1);return F(()=>{let i=t.value?.time||0;i>n.current&&(n.current=i,e.update(()=>{o.current=!0,AR(t.value)}))},[e,t.value]),f(kR,{onChange:i=>{if(o.current){o.current=!1;return}i.read(()=>{let s=IR();n.current=s?.time||0,t.onChange&&t.onChange(s)})},ignoreSelectionChange:!0})}Se();function yG(t){let e=!1;return t.querySelectorAll("a [style]").forEach(n=>{if(!(n instanceof HTMLElement))return;let o=n.style;(o.textDecoration?.includes("underline")||o.getPropertyValue("text-decoration")?.includes("underline"))&&(o.removeProperty("text-decoration"),o.removeProperty("text-decoration-skip-ink"),o.removeProperty("-webkit-text-decoration-skip"),e=!0)}),e}function xG(t){let e=!1;return t.querySelectorAll("[style]").forEach(n=>{n instanceof HTMLElement&&n.style.textAlign&&(n.style.removeProperty("text-align"),e=!0)}),e}function LR(){let[t]=ve();return F(()=>t.registerCommand(Pi,e=>{let{clipboardData:n}=e;if(!n)return!1;let o=n.getData("text/html");if(!o)return!1;let i=new DOMParser().parseFromString(o,"text/html"),s=!1;if(s=yG(i)||s,s=xG(i)||s,!s)return!1;e.preventDefault();let a=Gf(t,i),l=z();return B(l)?l.insertNodes(a):$o(a),!0},mf),[t]),null}Se();function RR(t){let{editor:e,setIsLinkEditMode:n}=t,{toolbarState:o}=dh();return F(()=>{let r=i=>{if(Vn(i,{}))return!1;if(wL(i))Ys(e);else if(TL(i)){let{code:s}=i,a=`h${s[s.length-1]}`;Gi(e,o.blockType,a)}else if(kL(i))_h(e,o.blockType);else if(SL(i))bh(e,o.blockType);else if(NL(i))e.dispatchCommand(at,"strikethrough");else if(DL(i))e.dispatchCommand(Kn,void 0);else if(OL(i))e.dispatchCommand(Eo,void 0);else if(IL(i))e.dispatchCommand(at,"subscript");else if(AL(i))e.dispatchCommand(at,"superscript");else if(ML(i))Tl(e);else if(LL(i)){let s=o.isLink?null:"";n(!o.isLink),e.dispatchCommand(Gn,s)}else return!1;return i.preventDefault(),!0};return e.registerCommand(mO,r,mf)},[e,o.isLink,o.blockType,n]),null}Se();var vG=/[\u00A0\u2011]/;function PR(){let[t]=ve();return F(()=>{if(!t.hasNodes([ji]))throw new Error("SpecialCharacterPlugin: SpecialCharacterNode not registered on editor");return t.registerNodeTransform(Ut,e=>{if(tL(e))return;let n=e.getTextContent(),o=vG.exec(n);if(o){let r=o.index,i=o[0],s;r===0?[s]=e.splitText(r+1):[,s]=e.splitText(r,r+1);let a=Gv(i);s.replace(a)}})},[t]),null}si();Se();function FR(t){let{editor:e}=t,n=J(null),o=J(null),[r,i]=L(null),[s,a]=L(!1),[l,c]=L(!1),[d,u]=L(!1),p=Ne(()=>{if(!r){c(!1),u(!1);return}e.getEditorState().read(()=>{try{let w=bd(r).getChildren(),S=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!wo(O))continue;if(O.getChildren().some(I=>I.getKey()===r.getKey())){S=D;break}}if(S!==-1){let D=w[S];if(wo(D)){let A=D.getChildren()[0];if(Ko(A)){let I=A.getHeaderStyles();c((I&On.ROW)===On.ROW)}}}let N=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!wo(O))continue;let A=O.getChildren();for(let I=0;I<A.length;I++)if(A[I].getKey()===r.getKey()){N=I;break}if(N!==-1)break}if(N!==-1){let D=w[0];if(wo(D)){let A=D.getChildren()[N];if(Ko(A)){let I=A.getHeaderStyles();u((I&On.COLUMN)===On.COLUMN)}}}}catch{c(!1),u(!1)}})},[e,r]);F(()=>{r&&s&&p()},[r,s,p]),F(()=>{if(!(!r||!s))return e.registerUpdateListener(()=>{p()})},[e,r,s,p]);let h=Ne(()=>{let T=o.current,w=n.current;if(!w||!r)return;let S=e.getElementByKey(r.getKey());if(!S)return;let N=S.getBoundingClientRect(),D=window.innerWidth,O=window.innerHeight;if(w.style.left=`${N.right-25}px`,w.style.top=`${N.top+5}px`,w.style.display="flex",T)if(s){let R=N.right-185,$=N.top+30;R<10&&(R=N.left),R+185>D-10&&(R=D-185-10),$+280>O-10&&($=N.top-280-5,$<10&&($=10)),T.style.left=`${R}px`,T.style.top=`${$}px`,T.style.display="block"}else T.style.display="none"},[e,r,s]);F(()=>{if(!r){n.current&&(n.current.style.display="none"),o.current&&(o.current.style.display="none"),a(!1);return}h();let T=()=>{h()},w=N=>{N.key==="Escape"&&s&&(a(!1),N.preventDefault(),N.stopPropagation())},S=N=>{o.current&&n.current&&!o.current.contains(N.target)&&!n.current.contains(N.target)&&a(!1)};return window.addEventListener("scroll",T,!0),document.addEventListener("keydown",w),document.addEventListener("mousedown",S),()=>{window.removeEventListener("scroll",T,!0),document.removeEventListener("keydown",w),document.removeEventListener("mousedown",S)}},[r,h,s]),F(()=>e.registerCommand(gn,()=>{let T=z();if(B(T)){let w=T.anchor.getNode(),S=Pv(w);Ko(S)?(r&&S.getKey()!==r.getKey()&&a(!1),i(S)):i(null)}else if(yM(T)){let w=T.getNodes();if(w.length>0){let S=Pv(w[0]);Ko(S)&&(r&&S.getKey()!==r.getKey()&&a(!1),i(S))}}else i(null);return!1},Ai),[e,r]);let g=Ne(()=>{e.update(()=>{r&&Bv(!1)}),a(!1)},[e,r]),m=Ne(()=>{e.update(()=>{r&&Bv(!0)}),a(!1)},[e,r]),_=Ne(()=>{e.update(()=>{r&&Fv(!1)}),a(!1)},[e,r]),b=Ne(()=>{e.update(()=>{r&&Fv(!0)}),a(!1)},[e,r]),y=Ne(()=>{e.update(()=>{r&&gM()}),a(!1)},[e,r]),v=Ne(()=>{e.update(()=>{r&&mM()}),a(!1)},[e,r]),x=Ne(()=>{e.update(()=>{if(!r)return;bd(r).remove()}),a(!1)},[e,r]),C=Ne(()=>{e.update(()=>{if(!r)return;let w=bd(r).getChildren(),S=-1;for(let R=0;R<w.length;R++){let $=w[R];if(!wo($))continue;if($.getChildren().some(P=>P.getKey()===r.getKey())){S=R;break}}if(S===-1)return;let N=w[S];if(!wo(N))return;let D=N.getChildren(),O=D[0],I=((Ko(O)?O.getHeaderStyles():0)&On.ROW)===On.ROW;D.forEach(R=>{if(Ko(R)){let $=R.getHeaderStyles(),W=I?$^On.ROW:$|On.ROW;R.setHeaderStyles(W,On.ROW)}})}),a(!1)},[e,r]),E=Ne(()=>{e.update(()=>{if(!r)return;let w=bd(r).getChildren(),S=-1;for(let R=0;R<w.length;R++){let $=w[R];if(!wo($))continue;let W=$.getChildren();for(let P=0;P<W.length;P++)if(W[P].getKey()===r.getKey()){S=P;break}if(S!==-1)break}if(S===-1)return;let N=w[0];if(!wo(N))return;let O=N.getChildren()[S],I=((Ko(O)?O.getHeaderStyles():0)&On.COLUMN)===On.COLUMN;w.forEach(R=>{if(!wo(R))return;let W=R.getChildren()[S];if(Ko(W)){let P=W.getHeaderStyles(),q=I?P^On.COLUMN:P|On.COLUMN;W.setHeaderStyles(q,On.COLUMN)}})}),a(!1)},[e,r]);if(!r)return null;let k=e.getRootElement();return k?ii(f(ke,{children:[f("button",{ref:n,className:"LexicalEditor__tableActionMenuButton",onClick:()=>a(!s),type:"button",children:"\u22EE"}),s&&f("div",{ref:o,className:"LexicalEditor__tableActionMenu",children:[f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:g,children:"Insert row above"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:m,children:"Insert row below"}),f("div",{className:"LexicalEditor__tableActionMenuDivider"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:_,children:"Insert column left"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:b,children:"Insert column right"}),f("div",{className:"LexicalEditor__tableActionMenuDivider"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:y,children:"Delete column"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:v,children:"Delete row"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:x,children:"Delete table"}),f("div",{className:"LexicalEditor__tableActionMenuDivider"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:C,children:l?"Remove row header":"Convert to row header"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:E,children:d?"Remove column header":"Convert to column header"})]})]}),k.parentElement||document.body):null}Se();function BR(){let[t]=ve();return F(()=>t.registerNodeTransform(vO,e=>{let n=e.getLastChild();Qt(n)||e.append(ge())}),[t]),null}var CG={namespace:"RootCMS",theme:YM,nodes:[vI,qf,Jf,al,fr,zi,Vf,ah,sh,vM,vl,Cl,ji],onError:t=>{throw console.error("[LexicalEditor] error:",t),t}};function zR(t){return f(YI,{initialConfig:CG,children:f(jM,{children:f(GM,{children:f("div",{className:xe(t.className,"LexicalEditor",t.variant==="comment"&&"LexicalEditor--comment",!t.autosize&&"LexicalEditor--withMaxHeight"),children:f(SG,{deepKey:t.deepKey,placeholder:t.placeholder,value:t.value,onChange:t.onChange,onFocus:t.onFocus,onBlur:t.onBlur,variant:t.variant,autoFocus:t.autoFocus,blockComponents:t.blockComponents,inlineComponents:t.inlineComponents})})})})})}var EG=Hv({name:"image",label:"Image Embed",preview:{title:"{file.alt}",image:"{file.src}"},fields:[kM({id:"file",label:"Image"}),zv({id:"caption",label:"Caption",variant:"textarea",translate:!0,deprecated:!0})]}),wG=Hv({name:"html",label:"HTML Code",preview:{title:"{html}"},fields:[zv({id:"html",label:"HTML",help:"HTML code to embed. Please use caution when inserting HTML.",variant:"textarea",autosize:!0,maxRows:50})]}),TG=[EG,wG];function SG(t){let{historyState:e}=VM(),[n]=ve(),[o,r]=L(n),[i,s]=L(!1),[a,l]=L(null),c=X(()=>{let D=new Map;return t.variant!=="comment"&&TG.forEach(O=>{D.set(O.name,O)}),t.blockComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.blockComponents]),d=Array.from(c.values()),[u,p]=L(null),h=X(()=>{let D=new Map;return t.inlineComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.inlineComponents]),g=Array.from(h.values()),[m,_]=L(null),b=D=>{D&&l(D)},y=(D,O)=>{let A=c.get(D);if(!A)return;let I=O?.initialValue?et(O.initialValue):sa(A);p({schema:A,mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},v=(D,O)=>{n.update(()=>{let A=js(D,O);$o([A]),A.selectNext()})},x=(D,O)=>{n.update(()=>{let A=Mt(D);Xr(A)&&A.setBlockData(O)})},C=()=>{p(null)};F(()=>{if(!t.deepKey)return;let D=O=>{let A=O.detail;if(!A||A.richTextDeepKey!==t.deepKey)return;let I=c.get(A.blockName);if(!I)return;let R=null,$=null;n.getEditorState().read(()=>{let W=tt(),P=-1;for(let q of W.getChildren())if(Xr(q)){P+=1;let ce=q.getBlockName();if(P===A.blockIndex&&ce===A.blockName){R=q.getKey(),$=q.getBlockData();break}}if(!R){for(let q of W.getChildren())if(Xr(q)&&q.getBlockName()===A.blockName){R=q.getKey(),$=q.getBlockData();break}}}),R&&p({schema:I,mode:"edit",initialValue:$?et($):{},nodeKey:R})};return window.addEventListener(jv,D),()=>window.removeEventListener(jv,D)},[n,t.deepKey,c]),F(()=>{if(!t.deepKey)return;let D=O=>{let A=O.detail;if(!A||A.richTextDeepKey!==t.deepKey)return;let I=h.get(A.componentName);if(!I)return;let R=null,$=null,W=null;n.getEditorState().read(()=>{for(let{node:P}of pI())if(El(P)&&P.getComponentId()===A.componentId){R=P.getKey(),$=P.getComponentData(),W=P.getComponentName();break}}),R&&_({schema:I,componentName:W||A.componentName,componentId:A.componentId,mode:"edit",initialValue:$?et($):{},nodeKey:R})};return window.addEventListener(Vv,D),()=>window.removeEventListener(Vv,D)},[n,t.deepKey,h]);let E=D=>{u&&(u.mode==="edit"&&u.nodeKey?x(u.nodeKey,D):v(u.schema.name,D),C())},k=(D,O)=>{let A=h.get(D);if(!A)return;let I=O?.initialValue?et(O.initialValue):sa(A);_({schema:A,componentName:D,componentId:O?.componentId||So(),mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},T=(D,O,A)=>{n.update(()=>{let I=ph(D,O,A);$o([I]),I.selectNext()})},w=(D,O,A,I)=>{n.update(()=>{let R=Mt(D);El(R)&&(R.setComponentName(O),R.setComponentId(A),R.setComponentData(I))})},S=()=>{_(null)},N=D=>{if(!m)return;let{componentName:O,mode:A,nodeKey:I}=m;A==="edit"&&I?w(I,O,D.componentId,D.data):T(O,D.componentId,D.data),S()};return f(HM,{components:h,onEditComponent:(D,O)=>k(D,{mode:O?.mode??"edit",initialValue:O?.initialValue,componentId:O?.componentId,nodeKey:O?.nodeKey}),children:f(BM,{blocks:c,onEditBlock:y,children:[f(MR,{value:t.value,onChange:t.onChange}),f(FL,{editor:n,activeEditor:o,setActiveEditor:r,setIsLinkEditMode:s,variant:t.variant,blockComponents:d,inlineComponents:g,onInsertBlockComponent:D=>y(D,{mode:"create"}),onInsertInlineComponent:D=>k(D,{mode:"create"})}),f(RR,{editor:o,setIsLinkEditMode:s}),f(cA,{externalHistoryState:e}),f($A,{contentEditable:f("div",{className:"LexicalEditor__scroller",children:f("div",{className:"LexicalEditor__root",ref:b,children:f(tA,{className:"LexicalEditor__editor",placeholder:f(NG,{placeholder:t.placeholder})})})}),ErrorBoundary:oA}),f(hA,{}),f(gA,{}),t.variant!=="comment"&&f(ke,{children:[f(fA,{}),f(SM,{}),f(FR,{editor:o}),f(UA,{maxIndent:7})]}),f(SR,{}),t.autoFocus&&f(WI,{}),f(BR,{}),f(PR,{}),f(LR,{}),t.variant!=="comment"&&f($L,{}),a&&f(ke,{children:[f(BL,{anchorElem:a,setIsLinkEditMode:s}),f(rL,{anchorElem:a,isLinkEditMode:i,setIsLinkEditMode:s})]}),u&&f(JM,{schema:u.schema,opened:!0,initialValue:u.initialValue,mode:u.mode,onClose:C,onSubmit:E}),m&&f(eL,{schema:m.schema,opened:!0,componentId:m.componentId,initialValue:m.initialValue,mode:m.mode,onClose:S,onSubmit:N})]})})}var $R=["Once upon a placeholder...","Start writing something legendary...","Words go here. Preferably brilliant ones...","Compose like nobody\u2019s watching...","Add text that makes Hemingway jealous...","Here lies your unwritten brilliance...","This is where the magic happens...","Let the words flow...","In the beginning, there was a blank page...","To write, or not to write, that is the question..."];function kG(){let t=Math.floor(Math.random()*$R.length);return $R[t]}function NG(t){let e=X(()=>t.placeholder||kG(),[]);return f("div",{className:"LexicalEditor__placeholder",children:e})}function HR(t){if(yw().preferences.EnableEditorJSEditor){let{deepKey:n,...o}=t;return f(xN,{...o})}return f(zR,{...t})}function UR(t){let e=t.field,[n,o]=L(null),r=rn().controller,i=s=>{o(a=>(a?.time!==s?.time&&r.updateKey(t.deepKey,s),s))};return Jo(t.deepKey,s=>{o(s)}),f(HR,{deepKey:t.deepKey,value:n,placeholder:e.placeholder,blockComponents:e.blockComponents,inlineComponents:e.inlineComponents,onChange:i,onFocus:t.onFocus,onBlur:t.onBlur,autosize:e.autosize})}Se();function KR(t){let e=t.field,[n,o]=It(t.deepKey,""),r=X(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return f("div",{className:"DocEditor__SelectField",children:f(Ln,{data:r,placeholder:e.placeholder,value:n,onChange:i=>o(i||""),size:"xs",radius:0,searchable:e.searchable??!0,clearable:!0,dropdownComponent:"div"})})}Se();function jR(t){let{value:e,variant:n,scrollRef:o}=t,r=e.split(/([\u00A0\u2011])/g);return f("div",{ref:o,className:`StringField__highlighter StringField__highlighter--${n}`,"aria-hidden":"true",children:[r.map((i,s)=>i==="\xA0"||i==="\u2011"?f("span",{className:"StringField__highlight",children:i},s):f("span",{children:i},s)),n==="textarea"&&e.endsWith(`
141
+ `)&&f("br",{})]})}function VR(t){let e=t.field,[n,o]=It(t.deepKey,""),r=J(null),i=J(null),[s,a]=L(null),l=g=>{o(g.currentTarget.value)},c=g=>{t.onFocus?.(g),to(t.deepKey,{scroll:!0})},d=g=>{t.onBlur?.(g),to(null)},u=g=>{let m=g.target.value;if(m.trim()){let _=m;try{let b=m.replace(/'([^'\\]*(?:\\.[^'\\]*)*)'/g,'"$1"').replace(/,\s*([\]}])/g,"$1");JSON.parse(b),_=b}catch{}try{let b=JSON.parse(_),y=JSON.stringify(b,null,2);o(y),a(null)}catch(b){a(b.message)}}else a(null);t.onBlur?.(g),to(null)},p=g=>{r.current&&(r.current.scrollTop=g.target.scrollTop,r.current.scrollLeft=g.target.scrollLeft)},h=g=>{i.current&&(i.current.scrollLeft=g.target.scrollLeft)};return e.variant==="json"?f("div",{className:"StringField__container",children:[f(bn,{className:xe("StringField__input","StringField__input--json",s&&"StringField__input--error"),size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||20,value:n,onChange:l,onFocus:c,onBlur:u,onScroll:p}),s&&f("div",{className:"StringField__jsonError",children:["Invalid JSON: ",s]})]}):e.variant==="textarea"?f("div",{className:"StringField__container",children:[f(jR,{value:n||"",variant:"textarea",scrollRef:r}),f(bn,{className:"StringField__input",size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||12,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:p})]}):f("div",{className:"StringField__container",children:[f(jR,{value:n||"",variant:"input",scrollRef:i}),f(Jn,{className:"StringField__input",size:"xs",radius:0,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:h})]})}var GR=pt({});function wh(){return ft(GR)}function Ie(t){let e=t.docId.split("/")[0],n=iw(e),o=rn(),r=n.loading||o.loading,i=n.schema?.fields||[];return f(GR.Provider,{value:n?.schema?.types||{},children:f(jT,{children:f("div",{className:xe(t.className,"DocEditor"),children:[f(Sd,{visible:r,loaderProps:{color:"gray",size:"xl"}}),!r&&!t.hideStatusBar&&f(Ie.StatusBar,{...t,draft:o,collection:n.schema}),f("div",{className:"DocEditor__fields",children:i.map(s=>f(Ie.Field,{field:s,deepKey:`fields.${s.id}`},s.id))})]})})})}Ie.StatusBar=t=>{let{route:e,query:n}=MC(),{roles:o}=iu(),r=window.firebase.user.email||"",i=su(o,r),s=tw(o,r),a=t.draft,[l,c]=L(a.controller.getData());Jo("sys",S=>{c({sys:S})});let d=Ne(S=>{S==="unlocked"&&a.controller.removePublishingLock()},[a.controller]),u=fw({docId:t.docId,onChange:d}),p=Ne(S=>{if(S.action==="delete"){let N=t.docId.split("/")[0];e(`/cms/content/${N}`)}else S.action==="unlocked"&&a.controller.removePublishingLock()},[t.docId]),h=Ne(()=>{if(!s)return;let S=l?.sys?.publishingLocked;S&&u.open({existingLock:{reason:S.reason,until:S.until?S.until.toMillis():void 0}})},[s,l?.sys?.publishingLocked,u]),g=$w({docId:t.docId}),m=Rw(),[_,b]=L(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::checksVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[y,v]=L(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::searchVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[x,C]=L(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::aiVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),E=No();F(()=>{let S=N=>{b(N.detail===!0)};return window.addEventListener("root:checks-visible",S),()=>window.removeEventListener("root:checks-visible",S)},[]),F(()=>{let S=N=>{v(N.detail===!0)};return window.addEventListener("root:search-visible",S),()=>window.removeEventListener("root:search-visible",S)},[]),F(()=>{let S=N=>{C(N.detail===!0)};return window.addEventListener("root:ai-visible",S),()=>window.removeEventListener("root:ai-visible",S)},[]);let k=n.locale||"",T=n.modal||"";F(()=>{T==="localization"&&a.controller&&m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:k||void 0})},[]);let w=!l?.sys;return w?null:f("div",{className:"DocEditor__statusBar",children:[f("div",{className:"DocEditor__statusBar__viewers",children:f(XT,{id:`doc/${t.docId}`})}),f(Ie.SaveState,{}),l?.sys&&f("div",{className:"DocEditor__statusBar__statusBadges",children:f(sE,{doc:l,docId:t.docId,onPublishingLockClick:s?h:void 0})}),f("div",{className:"DocEditor__statusBar__buttonGroup",children:[f("div",{className:"DocEditor__statusBar__search",children:f(De,{label:"\u2318 + Shift + f",transition:"pop",withArrow:!0,children:f(Z,{className:xe("DocEditor__statusBar__buttonGroup__button",y?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:f(Qd,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},children:"Search"})})}),(window.__ROOT_CTX.checks||[]).length>0&&f("div",{className:"DocEditor__statusBar__checks",children:f(Z,{className:xe("DocEditor__statusBar__buttonGroup__button",_?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:f(ME,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-checks"))},children:"Checks"})}),E&&f("div",{className:"DocEditor__statusBar__ai",children:f(De,{label:"\u2318 + i",transition:"pop",withArrow:!0,children:f(Z,{className:xe("DocEditor__statusBar__buttonGroup__button",x?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:f(ts,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-ai"))},children:"Root AI"})})})]}),f("div",{className:"DocEditor__statusBar__i18n",children:f(Z,{variant:"default",color:"dark",size:"xs",leftIcon:f(zE,{size:16}),onClick:()=>{m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:n.locale||void 0})},children:"Localization"})}),f("div",{className:"DocEditor__statusBar__publishButton",children:w?f(Z,{color:"dark",size:"xs",onClick:()=>g.open(),loading:!0,disabled:!0,children:"Publish"}):QC(l)?f(De,{label:`Scheduled ${RC(l.sys.scheduledAt)} by ${l.sys.scheduledBy}`,transition:"pop",children:f(Z,{color:"dark",size:"xs",leftIcon:f(Hh,{size:16}),disabled:!0,children:"Publish"})}):eE(l)?f(De,{label:aE(l),transition:"pop",children:f(Z,{color:"dark",size:"xs",leftIcon:f(PE,{size:16}),disabled:!0,children:"Publish"})}):f(_w,{label:"You don't have access to publish this document",condition:!i,children:f(Z,{color:"dark",size:"xs",leftIcon:f(Hh,{size:16}),onClick:()=>g.open(),disabled:!i,children:"Publish"})})}),f("div",{className:"DocEditor__statusBar__actionsMenu",children:f(bw,{docId:t.docId,data:l,onAction:p})})]})};Ie.SaveState=()=>{let[t,e]=L("NO_CHANGES");return Vw(n=>{e(n)}),f("div",{className:"DocEditor__statusBar__saveState",children:[t==="SAVED"&&"saved!",t==="SAVING"&&"saving...",t==="UPDATE_PENDING"&&"saving...",t==="ERROR"&&"error saving"]})};Ie.Field=t=>t.field.deprecated?f(Ie.DeprecatedField,{...t}):f(Ie.FieldBody,{...t});Ie.DeprecatedField=t=>{let[e,n]=L(!0),o=wh();return Jo(t.deepKey,r=>{n(as(t.field,r,o))}),e?null:f(Ie.FieldBody,{...t})};Ie.FieldBody=t=>{let e=t.field,n=t.level??0,r=ac().value===t.deepKey,i=J(null),s=X(()=>e.type==="object"&&(e.variant||"drawer")==="drawer"?!1:!t.hideHeader&&!e.hideLabel,[t.hideHeader,e]);return F(()=>{r&&im(i.current)},[r]),f("div",{className:xe("DocEditor__field",e.deprecated&&"DocEditor__field--deprecated",r&&"deeplink-target"),"data-type":e.type,"data-level":n,id:t.deepKey,ref:i,children:[s&&f(Ie.FieldHeader,{...t}),f("div",{className:"DocEditor__field__input",children:e.type==="array"?f(Ie.ArrayField,{...t}):e.type==="boolean"?f(ZT,{...t}):e.type==="date"?f(QT,{...t}):e.type==="datetime"?f(zS,{...t}):e.type==="file"?f(Cn,{...t}):e.type==="image"?f(GS,{...t}):e.type==="multiselect"?f(YS,{...t}):e.type==="number"?f(qS,{...t}):e.type==="object"?f(Ie.ObjectField,{...t}):e.type==="oneof"?f(Ie.OneOfField,{...t}):e.type==="reference"?f(xa,{...t}):e.type==="references"?f(XS,{...t}):e.type==="richtext"?f(UR,{...t}):e.type==="select"?f(KR,{...t}):e.type==="string"?f(VR,{...t}):f("div",{className:"DocEditor__field__input__unknown",children:["Unknown field type: ",e.type]})})]})};Ie.FieldHeader=t=>{let e=t.field,n=e.label||e.id,o=ac(),r=X(()=>VT(t.deepKey||""),[t.deepKey]);return f("div",{className:xe(t.className,"DocEditor__FieldHeader"),children:[e.deprecated?f("div",{className:"DocEditor__FieldHeader__label",children:["DEPRECATED: ",n]}):f("div",{className:"DocEditor__FieldHeader__label",children:[f("span",{children:n}),t.deepKey&&f("a",{className:"DocEditor__FieldHeader__label__deeplink",href:r,tabIndex:-1,title:"Link to field",onClick:i=>{i.preventDefault(),window.history.replaceState({},"",r),o.setValue(t.deepKey)},children:"#"})]}),e.help&&f("div",{className:"DocEditor__FieldHeader__help",children:e.help}),f(Ie.FieldHeaderTranslationsActionIcon,{field:e,deepKey:t.deepKey})]})};Ie.FieldHeaderTranslationsActionIcon=t=>{let n=!!t.field.translate,r=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"];return!n||r.length<=1?null:f(Ie.FieldHeaderTranslationsActionIconInner,{...t})};Ie.FieldHeaderTranslationsActionIconInner=t=>{let e=t.field,n=Ow(),o=rn(),[r,i]=L(()=>o.controller.getValue(t.deepKey));Jo(t.deepKey,d=>{i(d)});let s=wh(),a=X(()=>as(e,r,s),[e,s,r]),[l,c]=L(!1);return F(()=>{if(!t.deepKey||!o.controller)return;let d=MG(t.deepKey);return o.controller.subscribe(d,p=>{c(p?.translate===!1)})},[t.deepKey,o.controller]),f("div",{className:"DocEditor__FieldHeader__translate",children:l?f(De,{label:"Translations are disabled",children:f(Ae,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;Gh(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:f(DE,{size:16})})}):a?f("div",{className:"DocEditor__FieldHeader__translate__iconDisabled",children:f(es,{size:16})}):f(De,{label:"Show translations",children:f(Ae,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;Gh(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:f(es,{size:16})})})})};Ie.ObjectField=t=>{let e=t.field,n=e.variant;return n||(t.isArrayChild?n="inline":n="drawer"),n==="drawer"?f(Ie.ObjectFieldDrawer,{...t}):f("div",{className:"DocEditor__ObjectField",children:f("div",{className:"DocEditor__ObjectField__fields",children:e.fields.map(o=>f(Ie.Field,{field:o,deepKey:`${t.deepKey}.${o.id}`},o.id))})})};Ie.ObjectFieldDrawer=t=>{let e=t.field,n=e.drawerOptions?.collapsed||!1,o=e.drawerOptions?.inline||!1,r=rn().controller,i=sm(),s=Qh(),a=wt(),l=ot(),c=ac(),d=!n||c.value.includes(t.deepKey),u=()=>{let _=r.getValue(t.deepKey)||{};i.set(_),ae({message:"Copied to clipboard",autoClose:2e3})},p=async()=>{let _=await i.get();if(!_||typeof _!="object"){ae({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}r.updateKey(t.deepKey,_),ae({message:"Pasted from clipboard",autoClose:2e3})},h=async _=>{await r.removeKey(t.deepKey),ae({message:"Cleared",autoClose:2e3}),await r.flush(),_&&a.closeModal(_)},g=()=>{let _=e.label||e.id||"drawer",b=a.openConfirmModal({...l,title:`Clear ${_}?`,children:f(ns,{size:"body-sm",weight:"semi-bold",className:"DocEditor__ObjectFieldDrawer__confirmText",children:"This will clear all values in this section. There is no undo."}),labels:{confirm:"Clear",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},closeOnConfirm:!1,onConfirm:()=>h(b)})},m=()=>{let _=r.getValue(t.deepKey)||{};s.open({data:_,onSave:b=>{r.updateKey(t.deepKey,b),s.close()}})};return f("div",{className:xe("DocEditor__ObjectFieldDrawer",o&&"DocEditor__ObjectFieldDrawer--inline"),children:f("details",{className:"DocEditor__ObjectFieldDrawer__drawer",open:d,children:[f("summary",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle",children:[f("div",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__icon",children:f(pE,{size:16})}),f(Ie.FieldHeader,{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__header",field:e,deepKey:t.deepKey}),f(G,{className:"DocEditor__ObjectFieldDrawer__drawer__menu",position:"bottom",transitionDuration:0,control:f(Ae,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__dots",onClick:_=>{_.stopPropagation(),_.preventDefault()},children:f(ia,{size:16})}),children:[f(G.Label,{children:"CLIPBOARD"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Bh,{size:18}),onClick:u,children:"Copy"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(jd,{size:18}),onClick:p,children:"Paste"}),f(G.Label,{children:"CODE"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Fh,{size:18}),onClick:m,children:"Edit JSON"}),f(G.Label,{children:"ACTIONS"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Xn,{size:18}),onClick:g,children:"Clear"})]})]}),f("div",{className:"DocEditor__ObjectFieldDrawer__drawer__content DocEditor__ObjectFieldDrawer__fields",children:e.fields.map(_=>f(Ie.Field,{field:_,deepKey:`${t.deepKey}.${_.id}`},_.id))})]})})};function DG(t,e){switch(e.type){case"update":{let n=t._new||[];return{...e.newValue,_new:n}}case"updateItem":{let n=t??{},r=[...n._array||[]][e.index],i=e.newValue??{};return e.draft.updateKey(`${e.deepKey}.${r}`,i),{...n,[r]:i}}case"add":{let n=t??{},o=So(),r=structuredClone(e.defaultValue||{}),i=[...n._array||[],o];e.draft.updateKeys({[`${e.deepKey}._array`]:i,[`${e.deepKey}.${o}`]:r});let s=t._new||[];return{...n,[o]:r,_array:i,_new:[...s,o]}}case"insertBefore":{let n=t??{},o=[...n._array||[]],r=So(),i=structuredClone(e.defaultValue||{});o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"insertAfter":{let n=t??{},o=[...n._array||[]],r=So(),i=structuredClone(e.defaultValue||{});o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"duplicate":{let n=t??{},o=[...n._array||[]],r=So(),i=structuredClone(e.value);o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"moveUp":{if(e.index===0)return t;let n=t??{},o=[...n._array||[]];return WR(o,e.index,e.index-1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index-1]}}case"moveDown":{let n=t??{},o=[...n._array||[]];return e.index>=o.length-1?t:(WR(o,e.index,e.index+1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index+1]})}case"moveTo":{let n=t??{},o=[...n._array||[]];if(e.fromIndex<0||e.fromIndex>=o.length||e.toIndex<0||e.toIndex>=o.length)return console.error("Invalid moveTo index",e),t;let r=o[e.fromIndex];return OG(o,e.fromIndex,e.toIndex),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:r}}case"removeAt":{let n={...t??{}},r=[...n._array||[]],i=r[e.index];return delete n[i],r.splice(e.index,1),e.draft.updateKeys({[`${e.deepKey}._array`]:r}),e.draft.removeKey(`${e.deepKey}.${i}`),{...n,_array:r}}case"pasteAfter":{let n=t??{},o=[...n._array||[]],r=So(),i=e.data;if(!i)return ae({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}case"pasteBefore":{let n=t??{},o=[...n._array||[]],r=So(),i=e.data;if(!i)return ae({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}default:return console.error("unknown action",e),t}}Ie.ArrayField=t=>{let e=rn().controller,n=t.field,[o,r]=bC(DG,{_array:[]}),i=ac(),s=sm(),l=(o??{})._array||[],c=o._new||[],[d,u]=L(null);Jo(t.deepKey,P=>{r({type:"update",newValue:P})}),F(()=>{o._moved?E(t.deepKey,l.indexOf(o._moved)):o._pasted&&E(t.deepKey,l.indexOf(o._pasted))},[o]);let p=P=>{let q=l[P],ce=`${t.deepKey}.${q}`;return e.getValue(ce)||{}},h=()=>{r({type:"add",draft:e,deepKey:t.deepKey,defaultValue:n.itemDefault||{}})},g=(P,q)=>{r({type:"pasteBefore",draft:e,deepKey:t.deepKey,index:P,data:q})},m=(P,q)=>{r({type:"pasteAfter",draft:e,deepKey:t.deepKey,index:P,data:q})},_=async P=>{g(P,await s.get())},b=async P=>{m(P,await s.get())},y=P=>{r({type:"insertBefore",draft:e,deepKey:t.deepKey,index:P,defaultValue:n.itemDefault||{}})},v=P=>{r({type:"insertAfter",draft:e,deepKey:t.deepKey,index:P,defaultValue:n.itemDefault||{}})},x=P=>{r({type:"duplicate",draft:e,deepKey:t.deepKey,index:P,value:p(P)})},C=P=>{r({type:"removeAt",draft:e,deepKey:t.deepKey,index:P})},E=(P,q)=>{document.getElementById(`summary-for-${P}.${l[q]}`)?.focus()},k=P=>{P>0&&r({type:"moveUp",draft:e,deepKey:t.deepKey,index:P})},T=P=>{P<l.length-1&&r({type:"moveDown",draft:e,deepKey:t.deepKey,index:P})},w=P=>{let q=p(P);s.set(q),u(null),ae({message:"Copied to clipboard",autoClose:2e3})},S=P=>{let q=p(P);s.set(q),u(P),ae({message:"Cut to clipboard",autoClose:2e3})},N=async P=>{let q=await s.get();if(!q){ae({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}if(m(P,q),d!==null){let ce=d;P<d&&(ce+=1),C(ce),u(null)}ae({message:"Pasted item",autoClose:2e3})},D=Qh(),O=ww(),A=P=>{let q=p(P);D.open({data:q,onSave:ce=>{console.log("[edit json] onSave()",ce),r({type:"updateItem",draft:e,index:P,newValue:ce,deepKey:t.deepKey}),D.close()}})},I=P=>{let q=p(P);O.open({data:q,onSave:ce=>{console.log("[ai edit] onSave()",ce),r({type:"updateItem",draft:e,index:P,newValue:ce,deepKey:t.deepKey}),O.close()}})};function R(P){return!!i.value.startsWith(`${t.deepKey}.${P}`)}let $=Ne((P,q)=>{if(!P.target)return;let ce=l.indexOf(q);P.metaKey&&P.key==="x"?(P.preventDefault(),S(ce)):P.metaKey&&P.key==="c"?(P.preventDefault(),w(ce)):P.metaKey&&P.key==="v"?(P.preventDefault(),N(ce)):P.metaKey&&(P.key==="Backspace"||P.key==="Delete")?(P.preventDefault(),C(ce),ae({message:"Deleted item",autoClose:2e3})):P.key==="ArrowUp"?(P.preventDefault(),k(ce)):P.key==="ArrowDown"?(P.preventDefault(),T(ce)):P.key==="ArrowLeft"?P.target.closest("details").open=!1:P.key==="ArrowRight"&&(P.target.closest("details").open=!0)},[t.deepKey,l,d]),W=f("div",{className:"DocEditor__ArrayField__add",children:[f(Z,{className:"DocEditor__ArrayField__add__button",color:"dark",size:"xs",leftIcon:f(gE,{size:16}),onClick:()=>h(),children:n.buttonLabel||"Add"}),f(G,{className:"DocEditor__ArrayField__add__menu",control:f(Ae,{className:"DocEditor__ArrayField__item__header__controls__dots",children:f(ia,{size:16})}),children:[f(G.Label,{children:"CLIPBOARD"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Zd,{size:18}),onClick:()=>N(l.length-1),children:"Paste item to end"})]})]});return l.length===0&&!o._new?f("div",{className:"DocEditor__ArrayField",children:[f("div",{className:"DocEditor__ArrayField__items",children:f("div",{className:"DocEditor__ArrayField__items__empty",children:"No items"})}),W]}):f("div",{className:"DocEditor__ArrayField",children:[f(Du,{onDragEnd:P=>{let{source:q,destination:ce}=P;ce&&r({type:"moveTo",fromIndex:q.index,toIndex:ce.index,draft:e,deepKey:t.deepKey})},children:f(Iu,{droppableId:"dnd-list",direction:"vertical",children:P=>f("div",{...P.droppableProps,ref:P.innerRef,className:"DocEditor__ArrayField__items",children:[l.map((q,ce)=>f(Ie.ArrayFieldItem,{field:n,parentDeepKey:t.deepKey,itemKey:q,index:ce,initialOpen:c.includes(q)||R(q)||!!n.defaultOpen,isCut:d===ce,aiEnabled:No(),onFocusHeader:E,onHeaderKeyDown:$,onMoveUp:k,onMoveDown:T,onInsertBefore:y,onInsertAfter:v,onDuplicate:x,onCopy:w,onPasteBefore:_,onPasteAfter:b,onEditJson:A,onAiEdit:I,onRemove:C},q)),P.placeholder]})})}),W]})};Ie.ArrayFieldItem=t=>{let e=`${t.parentDeepKey}.${t.itemKey}`;return f(Ou,{index:t.index,draggableId:t.itemKey,children:(n,o)=>f("div",{ref:n.innerRef,...n.draggableProps,className:xe("DocEditor__ArrayField__item__wrapper",o.isDragging&&"DocEditor__ArrayField__item__wrapper--dragging",t.isCut&&"DocEditor__ArrayField__item__wrapper--cut"),children:[f("div",{className:"DocEditor__ArrayField__item__handle",...n.dragHandleProps,onClick:()=>t.onFocusHeader(t.parentDeepKey,t.index),children:f(Gd,{size:18,stroke:"1.5"})}),f("details",{className:"DocEditor__ArrayField__item",open:t.initialOpen,onToggle:r=>{r.target.open?to(e,{scroll:!0}):to(null)},onMouseEnter:()=>{to(e)},onMouseLeave:()=>{to(null)},children:[f("summary",{id:`summary-for-${e}`,className:"DocEditor__ArrayField__item__header",onKeyDown:r=>t.onHeaderKeyDown(r,t.itemKey),tabIndex:0,children:[f("div",{className:"DocEditor__ArrayField__item__header__icon",children:f(qE,{size:6})}),f(Ie.ArrayFieldPreview,{field:t.field,deepKey:e,index:t.index}),f("div",{className:"DocEditor__ArrayField__item__header__controls",children:[f("div",{className:"DocEditor__ArrayField__item__header__controls__arrows",children:[f("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--up",onClick:()=>t.onMoveUp(t.index),children:f(hE,{size:20,strokeWidth:1.75})}),f("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--down",onClick:()=>t.onMoveDown(t.index),children:f(fE,{size:20,strokeWidth:1.75})})]}),f(G,{className:"DocEditor__ArrayField__item__header__controls__menu",position:"bottom",transitionDuration:0,control:f(Ae,{className:"DocEditor__ArrayField__item__header__controls__dots",children:f(ia,{size:16})}),children:[f(G.Label,{children:"INSERT"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Uh,{size:18}),onClick:()=>t.onInsertBefore(t.index),children:"Add before"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Zd,{size:18}),onClick:()=>t.onInsertAfter(t.index),children:"Add after"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Wd,{size:18}),onClick:()=>t.onDuplicate(t.index),children:"Duplicate"}),f(G.Label,{children:"CLIPBOARD"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Bh,{size:18}),onClick:()=>t.onCopy(t.index),children:"Copy"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Uh,{size:18}),onClick:()=>t.onPasteBefore(t.index),children:"Paste before"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Zd,{size:18}),onClick:()=>t.onPasteAfter(t.index),children:"Paste after"}),f(G.Label,{children:"CODE"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Fh,{size:18}),onClick:()=>t.onEditJson(t.index),children:"Edit JSON"}),t.aiEnabled&&f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(lu,{size:16}),onClick:()=>t.onAiEdit(t.index),children:"Edit with Root AI"}),f(G.Label,{children:"REMOVE"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Xn,{size:18}),onClick:()=>t.onRemove(t.index),children:"Remove"})]})]})]}),f("div",{className:"DocEditor__ArrayField__item__body",children:f(Ie.Field,{field:t.field.of,deepKey:e,hideHeader:!0,isArrayChild:!0,onFocus:()=>{to(e,{scroll:!0})},onBlur:()=>{to(null)}},e)})]})]})},t.itemKey)};Ie.ArrayFieldPreview=t=>{let e=rn().controller,n=wh(),[o,r]=L(e.getValue(t.deepKey)),i=X(()=>IG(t.field,o,n),[t.field,n,o]),s=X(()=>AG(t.field,o,t.index,n),[t.field,t.index,n,o]),a=X(()=>cu(l=>{r(l&&typeof l=="object"?{...l}:l)},250),[]);return F(()=>e.subscribeSubtree(t.deepKey,a),[t.deepKey,e,a]),f("div",{className:"DocEditor__ArrayField__item__header__preview",children:[i&&f("div",{className:"DocEditor__ArrayField__item__header__preview__image",children:f("img",{src:i,alt:"",className:"DocEditor__ArrayField__item__header__preview__image__img",loading:"lazy"})}),f("div",{className:"DocEditor__ArrayField__item__header__preview__title","data-preview":s})]})};Ie.OneOfField=t=>{let e=t.field,n=e.variant||window.__ROOT_CTX.defaultOneOfVariant||"dropdown",[o,r]=L(""),i=wh(),s=Array.isArray(e.types)?e.types:[],a={},l=[],c=[{value:"",label:e.placeholder||"Select type"}];s.forEach(x=>{let C,E;typeof x=="string"?(C=i[x],E=x):(C=x,E=x.name),E&&(C&&(a[E]=C,l.push(C)),c.push({value:E,label:E}))});let d=a[o||""],u=rn().controller,p=Sw(),h=X(()=>({}),[]);async function g(x,C){let E={};if(x){let k=a[x];if(C&&k){let T=sa(k),w=sw(k,C,i);Object.assign(E,iE(T,w))}else x in h?Object.assign(E,h[x]):k&&Object.assign(E,sa(k))}E._type=x,await u.updateKey(t.deepKey,E),r(x)}async function m(x){await g(x)}Jo(t.deepKey,x=>{r(x?._type||""),x?._type&&(h[x._type]=x)});function _(x){let C=x.target;C&&C.select&&C.select()}function b(){let x=[];return l.forEach(C=>{x.push({key:`${C.name}::__blank__`,schema:C}),(C.presets||[]).forEach(E=>{x.push({key:`${C.name}::${E.id}`,schema:C,preset:E})})}),x}function y(){p.open({options:b(),onSelect:async x=>{await g(x.schema.name,x.preset?.data),p.close()},onRemove:d?async()=>{await g(""),p.close()}:void 0})}let v=d&&f("div",{className:"DocEditor__OneOfField__fields",children:d.fields.map(x=>f(Ie.Field,{field:x,deepKey:`${t.deepKey}.${x.id}`,onBlur:()=>{to(null)},onFocus:()=>{to(`${t.deepKey}.${x.id}`,{scroll:!0})}},`${o}::${x.id}`))});if(n==="picker"){let x=d?d.label||d.name:e.placeholder||"Select type";return f("div",{className:"DocEditor__OneOfField DocEditor__OneOfField--picker",children:[f("div",{className:"DocEditor__OneOfField__pickerButton",children:[f("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),f(Z,{variant:"default",color:"dark",size:"xs",onClick:y,rightIcon:f(fo,{size:16}),children:x})]}),v]})}return f("div",{className:"DocEditor__OneOfField",children:[f("div",{className:"DocEditor__OneOfField__select",children:[f("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),f(Ln,{data:c,value:o,placeholder:e.placeholder,onChange:x=>m(x||""),onFocus:_,size:"xs",radius:0,searchable:!0,dropdownComponent:"div"})]}),v]})};function WR(t,e,n){if(t.length<=1)return t;let o=t[e];return t[e]=t[n],t[n]=o,t}function OG(t,e,n){let[o]=t.splice(e,1);t.splice(n,0,o)}function YR(t,e,n,o="title"){if(t.type==="oneof"){let r=t,i=e?._type;if(i){let s,a=Array.isArray(r.types)?r.types:[];return typeof a[0]=="string"?s=n[i]:s=a.find(l=>l.name===i),s?.preview?.[o]||null}}return null}function IG(t,e,n){let o=YR(t.of,e,n,"image");if(o)return ga(o,e)}function AG(t,e,n,o){let r=YR(t.of,e,o,"title");if(r){let i=ga(r,e,{index:n});if(i)return i}return t.preview?ga(t.preview,e,{index:n})??`item ${n}`:`item ${n}`}function MG(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}export{pP as a,fP as b,Xh as c,Qh as d,mP as e,tg as f,ng as g,qo as h,CP as i,cu as j,jw as k,rn as l,Vw as m,Nq as n,jv as o,Vv as p,Qse as q,zR as r,Ie as s,Tm as t};